Commit fb3eed9
Fix regression: refine guard overlap check in createConditionalExpressions()
The previous guard overlap check was too aggressive - it blocked creating
conditional expressions in both loops of createConditionalExpressions(),
including cases needed for variable certainty tracking.
The fix:
1. Only apply the guard overlap check in the first loop (type narrowing),
not the second loop (variable certainty/existence)
2. Additionally require that the guarded expression exists with certainty
Yes in the other branch before skipping - this ensures we only skip
when both branches define the variable (ambiguous type case), not when
a variable is only defined in one branch (certainty tracking case)
Adds regression test for the case reported by VincentLanglet where
$order should be certainly defined after two sequential if-blocks that
together cover all cases of a union type parameter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 8be11a9 commit fb3eed9
2 files changed
Lines changed: 39 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3604 | 3604 | | |
3605 | 3605 | | |
3606 | 3606 | | |
3607 | | - | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
3608 | 3610 | | |
3609 | 3611 | | |
3610 | 3612 | | |
| |||
3621 | 3623 | | |
3622 | 3624 | | |
3623 | 3625 | | |
3624 | | - | |
3625 | | - | |
3626 | | - | |
3627 | | - | |
3628 | | - | |
3629 | | - | |
3630 | | - | |
3631 | 3626 | | |
3632 | 3627 | | |
3633 | 3628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments