Skip to content

DESCRIBE emits duplicate IF headers for empty-then split normalization #487

@hjotha

Description

@hjotha

Problem

When DESCRIBE normalizes an empty-then split by negating the condition and swapping branches, it can emit the original split header before the normalization decision and then emit the normalized header again.

The generated MDL is syntactically invalid because the first header has no matching body/END IF. EXEC then fails with parse errors such as unmatched IF/ELSE/CASE tokens.

Expected behavior

DESCRIBE should emit exactly one split header: the final normalized header after branch analysis.

Fix direction

Delay non-enum split header emission until after empty-then swap analysis in both top-level traversal and nested traversal.

Validation

Add synthetic tests covering top-level and nested empty-then split normalization, asserting the IF header is emitted exactly once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions