mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 19:29:35 +00:00
b7567b1799
Several unusual constructs that lead to unreachable code are now recognized by flow analysis: - Control flow after an expression of the form `e ?? other` or `e ??= other`, where `e` has static type `Null` and `other` has static type `Never`, is considered unreachable. - Control flow predicated on an expression of the form `e is Never` evaluating to `true` is considered unreachable. - Control flow predicated on an expression of the form `e is! Never` evaluating to `false` is considered unreachable. - Control flow on the RHS of a null-aware access such as `e?.property...`, `e?.property = ...` or `e?.method(...)`, where `e` has static type `Null`, is considered unreachable (Note: this can arise in the presence of extension methods). Previously, these behaviors only took effect if `e` was a reference to a local variable. Note: the change to `regress/issue_31180` is because I’ve corrected the behavior of implicit temporary variables to not undergo a type change from `Null` to `dynamic`, so the dead code part of `null?[1]` is now erroneous. (I had to make this change in order for the last bullet above to work properly; without it, the type change to `dynamic` prevents flow analysis from recognizing that the code to the right of `?.` is unreachable.) There's no behavioral change to correct code, but I've captured the behavioral change to incorrect code in `tests/language_2/null_aware/null_aware_index_on_null_error_test.dart`. Bug: https://github.com/dart-lang/sdk/issues/49635 Change-Id: I8b24b3b040a34f897c0b61dcb9bd105be6d0af6d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251280 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> |
||
---|---|---|
.. | ||
co19 | ||
co19_2 | ||
corelib | ||
corelib_2 | ||
dartdevc | ||
dartdevc_2 | ||
ffi | ||
ffi_2 | ||
language | ||
language_2 | ||
lib | ||
lib_2 | ||
modular | ||
standalone | ||
standalone_2 | ||
web | ||
web_2 | ||
legacy_status_dart2js.csv | ||
OWNERS | ||
README.md |
This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/wiki/Testing.