Commit 61a968e
Skip non-discriminating guards in
- In `MutatingScope::createConditionalExpressions`, the filter that skips
non-discriminating guards previously required the target expression to
exist in the other scope's expression types. When the target was absent
(e.g. `$options['multiple']` not explicitly narrowed in the truthy branch),
the filter did not fire, allowing guards like `$instructions` (an unrelated
mutable variable) to create spurious conditional expression holders.
- Add an additional check: if the guard variable's type in our scope is
definitively a supertype of its type in the other scope (`.yes()`), the
guard is non-discriminating regardless of the target's presence, so skip it.
- The original check (requiring both target and guard in the other scope,
using `!.no()`) is preserved for cases where the target IS tracked, to
avoid regressions with `maybe` supertype results (e.g. `Event` vs
`OrderInterface`).
- Also fixes the same bug with strict comparison (`!==` instead of `!=`).createConditionalExpressions even when target is not tracked in the other scope1 parent 93d00a6 commit 61a968e
2 files changed
Lines changed: 54 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3749 | 3749 | | |
3750 | 3750 | | |
3751 | 3751 | | |
3752 | | - | |
3753 | | - | |
3754 | | - | |
| 3752 | + | |
3755 | 3753 | | |
3756 | | - | |
| 3754 | + | |
| 3755 | + | |
| 3756 | + | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
| 3761 | + | |
3757 | 3762 | | |
3758 | 3763 | | |
3759 | 3764 | | |
| |||
| 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 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments