| commit | 877fe38f0ce2dbe0575fa15a51e011d629a6ab07 | [log] [tgz] |
|---|---|---|
| author | Ömer Sinan Ağacan <omersa@google.com> | Fri Jun 02 16:20:31 2023 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Jun 02 16:20:31 2023 +0000 |
| tree | 9d60d95cc65a918e0ec740f29b2d31f4a31bd8db | |
| parent | 8dfd80486e68b1241e5a0830255de16d9e1d099a [diff] |
[dart2wasm] Fix runtime type tests This was originally implemented in a289c4d but then reverted in dc33261 as it broke Flutter: https://github.com/flutter/flutter/issues/124282. The problematic code in Flutter was updated, so landing the fix again. Original commit message: `emitTypeTest` optimizes a test like `x is List<T>` where `x : Iterable<T>`, i.e. tested-against type is a subtype of the operand's static type. In these cases we can check just the class ID of the operand without checking the type arguments. However this optimization cannot be done when the types don't have same number of type arguments. Example: class H1<T> {} bool test(Object o) { return o is H1<num>; } void main() { print(test(H1<Object>())); } Here `H1<num> <: Object`, but we still need to check the type parameter. This CL checks that the types have the same number of type arguments before optimizing the test. Fixes #51187. This fix reveals another bug in `static_interop_test`, which is tracked in #51200. The test is updated to work around the bug for now. New passing tests: - co19/LanguageFeatures/Patterns/matching_cast_A01_t01 - co19/LanguageFeatures/Patterns/matching_list_A01_t01 - co19/LanguageFeatures/Patterns/matching_list_A01_t02 - co19/LanguageFeatures/Patterns/matching_list_A01_t03 - co19/LanguageFeatures/Patterns/matching_map_A01_t01 - co19/LanguageFeatures/Patterns/matching_map_A01_t02 - co19/LanguageFeatures/Patterns/matching_object_A01_t01 - co19/LanguageFeatures/Patterns/matching_object_A01_t02 - co19/LanguageFeatures/Patterns/record_A01_t03 - co19/LanguageFeatures/Patterns/record_A01_t06 - co19/LanguageFeatures/Patterns/record_A01_t07 - co19/LanguageFeatures/Patterns/record_A01_t08 - co19/LanguageFeatures/Patterns/record_A01_t09 - language/generic/deep_test - language/generic_methods/type_expression_test - language/patterns/object_pattern_inference_test Change-Id: Ia08ef466f74c3c55a61d4dbf0088e4b43713ee1d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307046 Commit-Queue: Ömer Ağacan <omersa@google.com> Reviewed-by: Joshua Litt <joshualitt@google.com>
Dart is:
Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.
Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.
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.