Skip to content

Commit caba043

Browse files
stereotype441Commit Queue
authored andcommitted
Lock "unreachable via this" tests to language version 3.1.
When these tests were written (https://dart-review.googlesource.com/c/sdk/+/178880), Dart did not support field promotion. I was getting ready to add "why not promoted" logic to flow analysis so that if a user tried and failed to promote a field, and received an assignability error as a result, they would receive a helpful error message explaining that field promotion was not supported. In order to generate this error message, flow analysis would have to start keeping track of some *counterfactual* promoted types, indicating what the type of certain expressions *would have been* if field promotion had been supported. It was important to make sure that these counterfactual promoted types were only used for error message generation, and didn't actually change Dart semantics. So I wrote these tests to help lock down the existing (non-promotion) behavior. When field promotion was actually implemented in Dart 3.2, these tests should have been given `@dart=3.1` annotations, since their purpose was to validate the correct behavior of the implementation in situations where field promotion *wasn't* enabled. I should have been prompted to do this by a test failure, because when I enabled field promotion by default in Dart 3.2, the behavior of the tests should have changed. However, because of dart-lang/language#4127, the behavior didn't change, so I didn't notice that these tests needed updating. Now, I'm getting ready to fix dart-lang/language#4127, so in order to prepare for that, I need to give these tests the proper `@dart=3.1` annotations. Bug: dart-lang/language#4127 Change-Id: I59ad1eef7b01ccedcc8fb99e070a05273ac365e6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389781 Reviewed-by: Kallen Tu <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 4f01b04 commit caba043

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tests/language/nnbd/flow_analysis/unreachable_via_this_property_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=3.1
6+
57
/// This test verifies that `is` and `==` tests performed on a property get of
68
/// `this` do not lead to code being considered unreachable. (In principle, we
79
/// could soundly mark some such code as unreachable, but we have decided not to

tests/language/nnbd/flow_analysis/unreachable_via_variable_property_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=3.1
6+
57
/// This test verifies that `is` and `==` tests performed on a property get of a
68
/// variable do not lead to code being considered unreachable. (In principle,
79
/// we could soundly mark some such code as unreachable, but we have decided not

0 commit comments

Comments
 (0)