Commit 1540a33
[sound flow analysis] Implement behaviors for null-aware map entries.
It turns out that the flow analysis logic for null-aware map entries
has always presumed sound null safety. That is, given a map entry with
a null-aware key (`{?x: y}`), flow analysis assumed that if the key
was non-nullable, then the value was guaranteed to execute.
However, another piece of logic that could have been implemented, and
wasn't, was that if the key had static type `Null`, then the value was
guaranteed _not_ to execute. This logic would have been sound even
without assuming sound null safety (because even in unsound null
safety mode, the type `Null` was only inhabited by the value `null`).
This change implements the missing logic. Even though it doesn't
strictly depend on the assumption sound null safety, it still makes
sense to guard it by the `sound-flow-analysis` flag, because (a) it's
a potentially breaking change, and (b) it brings the flow analysis
behavior of null-aware map entries into alignment with the other
behaviors that are being implemented as part of the
`sound-flow-analysis` feature.
There is no behavioral change if the feature `sound-flow-analysis` is
disabled.
Bug: #60438
Change-Id: Ie711f582660a31a411be0dc339995df140feb04f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420800
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>1 parent 0bf9183 commit 1540a33
File tree
2 files changed
+69
-2
lines changed2 files changed
+69
-2
lines changedLines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5196 | 5196 | | |
5197 | 5197 | | |
5198 | 5198 | | |
5199 | | - | |
5200 | | - | |
| 5199 | + | |
| 5200 | + | |
| 5201 | + | |
| 5202 | + | |
| 5203 | + | |
| 5204 | + | |
| 5205 | + | |
| 5206 | + | |
| 5207 | + | |
| 5208 | + | |
| 5209 | + | |
| 5210 | + | |
| 5211 | + | |
| 5212 | + | |
| 5213 | + | |
5201 | 5214 | | |
5202 | 5215 | | |
5203 | 5216 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10968 | 10968 | | |
10969 | 10969 | | |
10970 | 10970 | | |
| 10971 | + | |
| 10972 | + | |
| 10973 | + | |
| 10974 | + | |
| 10975 | + | |
| 10976 | + | |
| 10977 | + | |
| 10978 | + | |
| 10979 | + | |
| 10980 | + | |
| 10981 | + | |
| 10982 | + | |
| 10983 | + | |
| 10984 | + | |
| 10985 | + | |
| 10986 | + | |
| 10987 | + | |
| 10988 | + | |
| 10989 | + | |
| 10990 | + | |
| 10991 | + | |
| 10992 | + | |
| 10993 | + | |
| 10994 | + | |
| 10995 | + | |
| 10996 | + | |
| 10997 | + | |
| 10998 | + | |
| 10999 | + | |
| 11000 | + | |
| 11001 | + | |
| 11002 | + | |
| 11003 | + | |
| 11004 | + | |
| 11005 | + | |
| 11006 | + | |
| 11007 | + | |
| 11008 | + | |
| 11009 | + | |
| 11010 | + | |
| 11011 | + | |
| 11012 | + | |
| 11013 | + | |
| 11014 | + | |
| 11015 | + | |
| 11016 | + | |
| 11017 | + | |
| 11018 | + | |
| 11019 | + | |
| 11020 | + | |
| 11021 | + | |
| 11022 | + | |
| 11023 | + | |
| 11024 | + | |
10971 | 11025 | | |
10972 | 11026 | | |
10973 | 11027 | | |
| |||
0 commit comments