dart-sdk/tests
Paul Berry b7567b1799 Flag additional code as unreachable due to types Null and Never.
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>
2022-08-22 16:50:19 +00:00
..
co19 [co19] Enable fixed tests in the co19 .status file 2022-08-11 13:22:52 +00:00
co19_2 [infra] Add missing parenthesis in co19 update scripts 2022-07-25 14:14:59 +00:00
corelib [ddc] Ensure status file entries are consistent 2022-08-08 17:23:50 +00:00
corelib_2 Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
dartdevc Revert "Refactor _Future." 2022-06-09 16:51:55 +00:00
dartdevc_2 [ddc] Ensure status file entries are consistent 2022-08-08 17:23:50 +00:00
ffi [vm/ffi] NativeFieldWrapper FfiNative check receivers for nullptr 2022-08-11 17:39:57 +00:00
ffi_2 Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
language Flag additional code as unreachable due to types Null and Never. 2022-08-22 16:50:19 +00:00
language_2 Flag additional code as unreachable due to types Null and Never. 2022-08-22 16:50:19 +00:00
lib Add Isolate.run. 2022-08-18 10:42:55 +00:00
lib_2 Add Isolate.run. 2022-08-18 10:42:55 +00:00
modular [package:js] Add static interop stub for outlines 2022-06-17 19:58:49 +00:00
standalone Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
standalone_2 Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
web [dart2wasm] Implement the three-pronged WasmGC type hierarchy. 2022-08-19 07:11:18 +00:00
web_2 [dart2js] Handle private names correctly in K/J-model 2022-08-11 06:56:32 +00:00
legacy_status_dart2js.csv
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
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.