| commit | f7d5d0cfbeaade73f322811da5e1527cd053201f | [log] [tgz] |
|---|---|---|
| author | Paul Berry <paulberry@google.com> | Wed Mar 20 17:33:28 2024 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Mar 20 17:33:28 2024 +0000 |
| tree | e07d4c6e4ccf97ef98957a0bf8795c8cfa802929 | |
| parent | 5120f166f199b14bb91d4f129919116d8e00bda4 [diff] |
Remove special analyzer behavior for await expressions with "null context". In the front end, type inference of an expression always takes place with respect to a type schema (the "context"). In the analyzer, type inference of an expression sometimes takes place with respect to a context, but sometimes takes place with respect to no context at all; the latter circumstance arises when the analyzer uses its standard AstVisitor mechanism to call one of the visit methods in the ResolverVisitor class, and so the visit method's contextType argument takes on the value null. Because of this I am calling this situation a "null context". In all the circumstances where the analyzer infers an expression using a null context, the front end infers the same expression using a context of _. Furthermore, prior to this change, all but one of the analyzer's visit methods treated a null context the same as they treated a context of _. The one exception was visitAwaitExpression: in this method, if the context was the null context, then the analyzer analyzed the await expression's subexpression using a context of _; otherwise, it analyzed it using a context of FutureOr<_>. Whereas the front end, lacking any notion of a "null context", analyzes the await expression's subexpression using a context of FutureOr<_> in the same circumstances. This change brings the analyzer behavior into line with the front end. Fixes https://github.com/dart-lang/language/issues/3648. Bug: https://github.com/dart-lang/language/issues/3648 Change-Id: Ifd77988010d4387ce48eaa20dff4356beec03753 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357521 Reviewed-by: Konstantin Shcheglov <scheglov@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.