Commit 79c3917
[cfe] Fix type field promotion on LHS of
The CFE was passing the original LHS expression to
`flowAnalysis.ifNullExpression_rightBegin`. This was incorrect; it
needs to pass the rewritten LHS expression. Most of the time this was
harmless, since in most cases:
- The expression on the LHS of `??` was not promotable, in which case
passing the wrong expression didn't matter,
- Or the expression on the of `??` was a read of a local variable, in
which case there was no problem, since local variable reads don't
require rewriting.
However, in cases where the LHS of `??` is a read of a promotable
property, it does matter, since property reads are often rewritten
during inference.
Fixes #56874.
Bug: #56874
Change-Id: Ie42b96b0bc14faec38e8dbcb9e11534d4a1db0dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389140
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
Reviewed-by: Chloe Stefantsova <[email protected]>??.1 parent 70cab20 commit 79c3917
File tree
2 files changed
+27
-1
lines changed- pkg/front_end/lib/src/type_inference
- tests/language/inference_update_2
2 files changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2029 | 2029 | | |
2030 | 2030 | | |
2031 | 2031 | | |
2032 | | - | |
| 2032 | + | |
2033 | 2033 | | |
2034 | 2034 | | |
2035 | 2035 | | |
| |||
Lines changed: 26 additions & 0 deletions
| 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 | + | |
0 commit comments