Updated the ddc canary implementation to handle variance subtyping.
Variance subtyping is currently broken on DDC. This CL emits a runtime call to `addTypeParameterVariances` from `rti.dart` to annotate the type parameter variances of each interface that's appeared in type recipes. The rest of the subtyping algorithm already exists from the Dart2JS implementation, so the variance feature should be working correctly now in DDC with these changes and after the switch to canary by default.
Existing tests now pass: language/variance/variance_in_subtyping_test, language/variance/variance_inout_subtyping_test
Fixes https://github.com/dart-lang/sdk/issues/54367
Change-Id: I8483570184de61f2a6d365f89446720ef2349608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338651
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Previously we would encode the type of the value returned in `async`
functions as the field `futureValueType` on `FunctionNode`. For all
other kinds of functions, such as `sync`, `sync*`, and `async*`, that
field would be null. This CL renames `futureValueType` into
`emittedVAlueType`, and for functions of kinds `async`, `sync*`, and
`async*` that is expected to be the type of values emitted via
`return` or `yield` statements. For `sync` functions that field is
supposed to contain `null`.
In response to https://github.com/dart-lang/sdk/issues/54159
TEST=existing
Change-Id: I1efdbcc4e75d150f5618c7ca50cfe49a0e54fce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
We want to be able to emit variance information in DDC and this flag was gating the variance checking logic in `rti.dart`.
Set to `true` by default since we can't use the feature without the experiment enabled anyways.
Change-Id: I69a0691e9fbe6f0f355fc7319151c19bbffc1961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341640
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Stop running expression evaluation and module symbols tests on legacy
code. These still run with unsound null safety, just on migrated code.
Change-Id: Ifb602c058ebcc3fbd8254e8c2f431f8b18146a64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337615
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Update source code in tests to be migrated to null safety. Tests are
still running in unsound null safety.
In most cases types are now inferred to be non-nullable so the code that
makes expressions to be seen as nullable now require `as dynamic` to
allow them to compile.
Update nullable inference logic to recognize `.toString()` on a String
as non-nullable in code that has been migrated to null safety.
Change-Id: Id0771cc5317e3dafbf10e766b80d2994752bacc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337700
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
This adds support using experimental features in id testing in DDC and
uses it to add tests for scopes in extensions, extension types and
mixins.
The tests show that the DartScopeBuilder and DartScopeBuilder2 differ
on the scope on instance members in extensions and extension types for
the synthetic #this variable.
Change-Id: Iec0f3b938da567578b1245ada885370fb2a8b33f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335824
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This adds a CFE test for DartScope that shares the data with the
corresponding DDC test. The CFE test uses the DartScopeBuilder2
which is currently in development to replace the DartScopeBuilder.
Change-Id: I0d6c76957e7a5d28babab14110d430935e686b22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335821
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Some SDK only inline helper methods expect specific types passed to
them. These expectations can't be enforced by the type system and
everything is currently working properly. Extension methods may cause
confusion in the future so this change adds a bit more context to
the error messages just in case.
Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: Idc620993d1a240fa5aaaccd4519433b04f0ba9ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335942
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
- In development mode (DDC) the extra null safety errors will be thrown.
- Remove extra code paths that called unsound helpers.
- Fix expectations in weak_null_safety_errors_test.dart.
Change-Id: I107c602b0ae38b13038e501564cba9b8cfc58e70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329568
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
The @dart marker should only be used for released language versions,
rather than the upcoming release, since the upcoming language features
has not been finally assigned to a language version yet. The appropriate
experiments should be used instead to opt into upcoming features.
This change is part of the effort to make it possible to easily bump
tools/VERSION without unexpected issues whenever tests have to have
their pinned language versions updated as well.
Bug: b/304745266
Change-Id: If9c7f07bb8bf0482257d0476b4e7d64077e53b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330106
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
- Add a new dart2js preamble file that seals the native object prototype.
- Use the file when running DDC in d8 locally.
Once this change lands the new preamble can be used in the script that
runs d8 on the benchmarking bots.
If benchmark results look good, I will followup with a change to enable
the prototype sealing in SDK test configurations as well.
Change-Id: I00ffb14751a9b7e874e2e91fcb753a6382f0d577
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329825
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This renames ExtensionType.typeErasure and adds it to DartType. This also fixes the extension type erasure for when extension types are used in the arguments of an extension type.
DartType.extensionTypeErasure can be used by backends to easily
access the type without extension types for any type.
TEST=pkg/kernel/test/extension_type_erasure_test.dart
Change-Id: Ia49d273ed85111e3ae822720860a3e0be5ea0252
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329960
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Please prefer not to revert this change. Any tests that fail are release
blockers and need to be approved and urgently fixed forward. Dart 3.2
has already been cut and the version number must be updated. It is
acceptable for rolls to be blocked until the release blockers have been
resolved as P0 issues.
Remove needless version number comment from experimental_features to
remove duplicated information and simplify version updates.
Update dartdoc to a version that supports 3.3.
Change-Id: I1a19aa86e185c99e61374665f18cf24c498935a5
Tested: CQ
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329588
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Jonas Termansen <sortie@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Remove needless version number comment from experimental_features to
remove duplicated information and simplify version updates.
Tested: CQ
Change-Id: I864bfc44070136406e95fdaf4d83f491b2c95943
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329460
Reviewed-by: Alexander Thomas <athom@google.com>
Adds simple method inlining for select patterns only in the dart:_rti
library as an optimization. This helps avoid chains of costly
accesses method calls that in the end simply perform a single
operation and return the result.
For example and snipet from the compiled SDK before:
```
if (_rti._isString(object)) {...}
```
and after:
```
if(typeof object == "string") {...}
```
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I90596294d35a8fd75d74014c6a12f6e8c726cfcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324571
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Always throw on `InvalidType` and `AuxiliaryType` in all `DartType`
visitors. These are not expected to exist at this stage in the
compilation.
Change-Id: I8486e4245d6eae895d9420ca64a216aa207af80e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327980
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Now that the `DartType` class hierarchy is sealed if-else chains over
different `DartType`s can be replaced with exhaustive switch
statements.
Ensures the coverage of all types and provides compile time errors
when new types are added without handling them.
Delete the awkward assertion logic that we had before.
Issue: https://github.com/dart-lang/sdk/issues/53566
Change-Id: Ia400b0dcddb569bb8123a5c1d9e7704f8930bb55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327982
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Now that the `DartType` class hierarchy is sealed if-else chains over
different `DartType`s can be replaced with exhaustive switch
statements.
Ensures the coverage of all types and provides compile time errors
when new types are added without handling them instead of the awkward
assertion logic that we had before.
Issue: https://github.com/dart-lang/sdk/issues/53566
Change-Id: Ia78d403610259ca80c30ef52b1c46e475463e277
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327981
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Now that the `DartType` class hierarchy is sealed if-else chains over
different `DartType`s can be replaced with exhaustive switch
statements.
Ensures the coverage of all types and provides compile time errors
when new types are added without handling them instead of the awkward
assertion logic that we had before.
Issue: https://github.com/dart-lang/sdk/issues/53566
Change-Id: If6228ee05cafbe89e49b137d5b1555dbb3447a56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327021
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Now that the `DartType` class hierarchy is sealed if-else chains over
different `DartType`s can be replaced with exhaustive switch
statements.
Ensures the coverage of all types and provides compile time errors
when new types are added without handling them instead of the awkward
assertion logic that we had before.
Issue: https://github.com/dart-lang/sdk/issues/53566
Change-Id: I5624dd53e8cb6f88d10a713e11e1488c28d67698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327020
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>