-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional tests of
??=
coercion behaviors for inference-update-3
.
The tests for the language feature `inference-update-3` are adjusted to verify that the following hold true for an if-null expression of the form `e1 ??= e2`: - If the static type of `e2` is not a subtype of the write type of `e1`, but it is assignable via a coercion, then the coercion is performed, and the coerced type of `e2` is used to compute the static type of the whole `??=` expression. - If `e1` is a promoted local variable, then coercions are performed based solely on the declared (unpromoted) type of `e1`. These behaviors apply regardless of whether feature `inference-update-3` is enabled; accordingly, this commit updates both the `_test.dart` and `_disabled_test.dart` variants of the tests. I've manually verified that even with the work on `inference-update-3` reverted, the `_disabled_test.dart` tests continue to pass, so we can be reasonably certain that these behaviors pre-date the work on the `inference-update-3` feature. Note: the diff is large due to the fact that the front end has 6 different code paths for handling `??=`, depending on the form of the LHS, so to make sure that we have adequate test coverage, there are tests for every possible LHS form. However, the diffs for all the tests are pretty much the same except for `if_null_assignment_local_disabled_test.dart` and `if_null_assignment_local_test.dart`, which have extra test cases to cover promotion behaviors. Bug: dart-lang/language#1618 Change-Id: I711d62d9dc00fc20a2efd3967d60066d9bfaec03 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356303 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
- Loading branch information
1 parent
1285976
commit 6d12146
Showing
46 changed files
with
5,091 additions
and
1,199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.