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.
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.