Problem
Top-level IF traversal can emit an empty else branch when the false branch points at a continuation that has already been emitted while traversing the true branch.
The false destination is not necessarily the selected merge, so the existing falseFlow.DestinationID != mergeID check can decide that an ELSE body exists. But the actual false-branch traversal then produces no statements because the continuation is already visited.
This creates MDL like:
if $UseNestedPath then
...
else
end if;
A later exec/describe pass removes the empty branch, leaving a roundtrip mismatch.
Expected behavior
Top-level IF traversal should behave like nested IF traversal: only keep else if traversing the false branch actually emits statements.
Proposed fix
Emit the else line tentatively, traverse the false branch with an isolated visited map, and remove the line again if no statements were produced.
Problem
Top-level IF traversal can emit an empty
elsebranch when the false branch points at a continuation that has already been emitted while traversing the true branch.The false destination is not necessarily the selected merge, so the existing
falseFlow.DestinationID != mergeIDcheck can decide that an ELSE body exists. But the actual false-branch traversal then produces no statements because the continuation is already visited.This creates MDL like:
A later exec/describe pass removes the empty branch, leaving a roundtrip mismatch.
Expected behavior
Top-level IF traversal should behave like nested IF traversal: only keep
elseif traversing the false branch actually emits statements.Proposed fix
Emit the
elseline tentatively, traverse the false branch with an isolated visited map, and remove the line again if no statements were produced.