| commit | 6d12146e75d453051adace0c9d58dd2469f2f73e | [log] [tgz] |
|---|---|---|
| author | Paul Berry <paulberry@google.com> | Tue Mar 12 22:45:28 2024 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Mar 12 22:45:28 2024 +0000 |
| tree | 046d03d703b99a0870f6e658161a5ef2748fa1aa | |
| parent | 12859761b9d46b14e7f33c7433ddd3e991709a54 [diff] |
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: 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>
Dart is:
Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.
Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.