Commit 12a32f4
[sound flow analysis] Implement
This change updates the logic in the flow analysis method
`promoteForPattern`, so that when the language feature
`sound-flow-analysis` is enabled, the following additional behaviors
are added:
- If the matched value type is non-nullable, and the pattern
implicitly performs an `is Null` test, then the pattern is known not
to match.
- If the matched value type is `Null`, and the pattern implicitly
performs an `is T` test, where `T` is a non-nullable type, then the
pattern is known not to match. Note that this reasoning step is
sound regardless of whether the program is running with sound null
safety enabled, but since it is a new reasoning step, it only takes
place if the `sound-flow-analysis` feature is enabled.
There is no behavioral change if the feature `sound-flow-analysis` is
disabled.
Bug: #60438
Change-Id: I5a6e8def050c95b6c1ad01d37584d17a0cd590c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421900
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>promoteForPattern behaviors.1 parent f5a77ab commit 12a32f4
File tree
3 files changed
+554
-6
lines changed3 files changed
+554
-6
lines changedLines changed: 30 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5341 | 5341 | | |
5342 | 5342 | | |
5343 | 5343 | | |
5344 | | - | |
5345 | | - | |
5346 | | - | |
5347 | | - | |
5348 | | - | |
5349 | | - | |
| 5344 | + | |
| 5345 | + | |
| 5346 | + | |
| 5347 | + | |
| 5348 | + | |
| 5349 | + | |
| 5350 | + | |
| 5351 | + | |
| 5352 | + | |
| 5353 | + | |
| 5354 | + | |
| 5355 | + | |
| 5356 | + | |
| 5357 | + | |
| 5358 | + | |
| 5359 | + | |
| 5360 | + | |
| 5361 | + | |
| 5362 | + | |
| 5363 | + | |
| 5364 | + | |
| 5365 | + | |
| 5366 | + | |
| 5367 | + | |
| 5368 | + | |
| 5369 | + | |
| 5370 | + | |
5350 | 5371 | | |
5351 | 5372 | | |
5352 | 5373 | | |
| |||
5384 | 5405 | | |
5385 | 5406 | | |
5386 | 5407 | | |
| 5408 | + | |
| 5409 | + | |
| 5410 | + | |
5387 | 5411 | | |
5388 | 5412 | | |
5389 | 5413 | | |
| |||
0 commit comments