Commit 5c47c5e
authored
allow nullability flow typing even in presence of pattern match (#18206)
Nullability flow typing is conservatively disabled for mutable variables
to which a write occurs nested inside a Tree other than some known ones,
such as If and WhileDo. This is to prevent flow-sensitive reasoning for
variables that are captured and written to in a closure. Pattern matches
do not create a closure. This change enables nullability flow typing
even for mutable variables that are written to inside a pattern match.File tree
2 files changed
+22
-1
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/explicit-nulls/pos
2 files changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
459 | | - | |
| 459 | + | |
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| |||
| 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 | + | |
0 commit comments