6d12146e75
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: https://github.com/dart-lang/language/issues/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>
This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/wiki/Testing.