Commit Graph

2319 Commits

Author SHA1 Message Date
David Morgan 56f2e00fd6 [macros] Skip macro library augmentations when considering input sources.
Add `package:front_end/src/api_prototype/macros.dart` for utilities
related to compiling macros. Export `isMacroLibraryUri`.

Use `isMacroLibraryUri` instead of hard-coding in a few places.

Add TODO about need to handle macro deps to places that are currently
listing sources as deps.

R=jakemac@google.com, johnniwinther@google.com

Change-Id: I5d2473b810afd42f487178f0aad995804da945c4
Tested: Manually tested with Flutter; e2e tests will be added under tests/macro_build.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
2024-03-21 15:54:19 +00:00
Jake Macdonald 25071fc448 revert dart:_macros, going with SDK vendored package
Change-Id: Iaaf80a44cdbd073b01132d04c0426e8acc28341f
Tested: Revert only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2024-03-21 02:40:58 +00:00
Nicholas Shahan 1cb4f090c3 [ddc] Refactor visitRecord(Index|Name)Get
Stop passing `null` as the member parameter of `_emitPropertyGet`.

Avoids the use of one method with multiple code paths and returns
to handle any situation because it becomes very hard to reason 
about what original source code leads to each path.

Issue: https://github.com/dart-lang/sdk/issues/54463
Change-Id: I31ada0647816e8c7db2dac56a0a56fd50d9bd0a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357205
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-14 15:11:48 +00:00
Sigmund Cherem 4a065c649d [ddc] speed up asset_file_system_test.
While working on the e2e tests, I noticed this test was taking a
long time. Turns out this was because it fully exercises an http
client retry logic using exponential backoff and up to 4 retries.

To reduce the costs, I changed the test to use controlled
environment instead. This still hits the same code-paths but
provides a faster turnaround by using at most 1 retry, and issuing
retries immediately.

With these changes, the test completes in 3s (instead of 28s).

I noticed that some of the tests to check an "unreliable" server
where non-deterministic (multiple parallel requests that sometimes
fail or succeed). The changes here also make it deterministic. While
this test seems to have some flakes due to other reasons, my hope is
that these changes will reduce the chances of this test being flaky
on the bots.

Change-Id: I8eb2a00c7a489ab4e5a46e2b5cdbee40d1ffb8d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356623
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-11 18:32:19 +00:00
Nicholas Shahan 98a3605562 [ddc] Fix assert location in expression eval
When assertions appear in a debugger expression they now have a
synthetic source location available. This also allows for the lookup
of the actual source.

Issue: https://github.com/dart-lang/sdk/issues/43986
Fixes: https://github.com/dart-lang/sdk/issues/54956
Change-Id: I34ae5f810593b40282929d02cb290de86603922f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356287
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-08 17:05:10 +00:00
David Morgan 6f7f571989 [macros] Fix basic macro compile with DDC, add e2e test.
The e2e test is for "how DDC is used in the language tests", more
realistic setupts to follow.

R=jakemac@google.com, nshahan@google.com

Change-Id: Iece44740d2e4d91748a7deef59f4e18ad42ac853
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356241
Auto-Submit: Morgan :) <davidmorgan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-08 11:37:46 +00:00
MarkZ 210e120fbd [ddc] Creating a hot reload and hot restart test suite.
The hot reload runner currently only supports d8, but I plan to add support for Chrome and VM execution.

Notable changes:
* Creates `package:reload_test` with helpers for running this suite.
* Updates the module loader with D8-specific branches and hooks for hot reload/restart.
* Exposes DDC runtime variables via a `HotReloadTestRuntime` API.
* Ports constant equality hot restart tests from webdev/dwds (validated to fail if either cache-clearing mechanism fails).
* Partially rolls DDC's d8 preamble forward (towards dart2js's).
* Wraps D8's timer implementation with custom timeout logic to better match Chrome's timing semantics when executing with native JS async.

Tests for the framework and matrix updates will be added in an upcoming change.

Change-Id: I2773b29f464cfd0330e4c653c05e117ae150b4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350021
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-03-05 00:12:18 +00:00
Nicholas Shahan 0231b2ae1f [ddc] Remove more unnecessary code
After the switch to the new type system more code is unnecessary.
- Clean up logic for deferring classes because the new type system
  allows us to flatten the search to just the immediate superclass.
- Delete more `emit<xxx>Type` helper methods.
- Further differentiate emitting a Type vs a reference to a Class.

Fixes: https://github.com/dart-lang/sdk/issues/54745
Change-Id: Ia6e1accb4c9c993967cd5444c18c65938954f7d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348766
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-02-21 23:04:43 +00:00
Sam Rawlins cda9755918 dev_compiler: prepare for curly_braces lint change
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.

Change-Id: I1b3ff4a4f85ec2182d06a67acf0e43fbc45129f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353220
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-02-20 16:04:30 +00:00
Johnni Winther 6e4674d445 [kerne] Remove type parameter from RecursiveVisitor
The type parameter was a left-over from a pre-nnbd encoding of the visitors, but Flutter dependency on the code prevented its removal.

TEST=existing

Change-Id: I02657a469290f169077faa1167cf59b75de13c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350840
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-02-19 07:51:43 +00:00
Nicholas Shahan 3c13e9f273 [ddc] Cleanup dead code from the runtime library
This code is no longer used now that the new runtime types are always
enabled.

Change-Id: I0c7d627199a10e023d5d1afa581812b360e9a0f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344609
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-16 22:33:54 +00:00
Nicholas Shahan 528e1092bc [ddc] Cleanup dead code from the compiler
This code is no longer used now that the new runtime types are always
enabled.

Change-Id: Ic8e59ed43931fc89efeee48269c7da388a6c6553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344606
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-16 17:40:08 +00:00
Nicholas Shahan 48dd473c21 [ddc] Delete new runtime types flag from compiler
Cleanup branches that are no longer reachable.

Change-Id: If53a80915f3c7dc444e7027a8287395add23165b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344605
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-15 22:24:27 +00:00
Nicholas Shahan f6ffe00f28 [ddc] Avoid calling addTypeCaches with new types
Some preparation for deleting all the old type system code.

Change-Id: I9319064100ce19a4122612c36781c7e4a71094aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352724
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-15 18:28:49 +00:00
Martin Kustermann c0371169b0 Cleanup some code regarding deprecated native syntax
The VM target no longer supports the `foo() native "foo";` syntax. See
final removal in [0].

Dart2Wasm has never really been using it.

* In the sdk dart2wasm uses `external` functions with
  recognizion in the compiler based on the name of the method.
* JS interop is using `@JS` based mechanism.
* Wasm to Wasm interop is based on `@Native<>()` annotations.

This means that only dart2js/ddc are remaining users of the
`foo() native;` syntax (without following string).

So we can clean up some code.

[0] https://dart-review.googlesource.com/c/sdk/+/266387

Issue https://github.com/dart-lang/sdk/issues/28791
TEST=ci

Change-Id: I929789f7a1ea5ed5423b0db0c6a306406e2db2af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351083
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-13 10:41:32 +00:00
Mayank Patke 85037bf96d [dart2js, ddc] Clean up conditional imports in dart2js_runtime_metrics
This CL:
* adds empty dart:_dart2js_only and dart:_ddc_only libraries for use in
  conditional imports,
* updates pkg/dart2js_runtime_metrics to use the new libraries rather
  than dart:_dart2js_runtime_metrics and dart:js,
* and removes some unnecessary libraries, including VM-specific
  implementations in pkg/dart2js_runtime_metrics and the DDC
  implementation of dart:_dart2js_runtime_metrics.

Change-Id: I9500aa303fa5ad8aba0e1d413f69957c268f3f11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350681
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-02-09 18:38:55 +00:00
Johnni Winther fe52b9bfe5 [macros] Add dart:_macros
This adds the dart:_macros library to the SDK and adds support for accessing dart:_macros from package:macros. The library is not used yet.

This change is needed as a prestep to adding the package:macros and using it in the CFE and analyzer, and needs to be rolled in as the checked in sdk before package:macros can be supported.

TEST=ci

Change-Id: Ife3ffd48527e3a196048d2ddf7387b8b7818f3a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348680
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-02 07:47:59 +00:00
MarkZ 91d22a7e40 [ddc] Renaming dart_library.js to ddc_module_loader.js
This also removes deprecated references to the DDC module system as the "legacy" module system.

This is part of an ongoing effort to deprecate the AMD module system: https://github.com/dart-lang/sdk/issues/52361

Change-Id: Ic32c6c6a0b7bf2c3bf0326be42cc9a88db8e303e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348183
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2024-01-30 19:43:49 +00:00
Nicholas Shahan 29f5b4141f [ddc] Don't emit old type system variance
The variance information emitted here is only used in the old
type system so it can be skipped when using the new representation.

Change-Id: I43093c1742f9a89ef018dd76ec7a0bcd477414c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348801
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-29 20:08:28 +00:00
Srujan Gaddam 3b294fdab2 [dart:js_interop] Add isA helper
Closes https://github.com/dart-lang/sdk/issues/54138

Adds a helper to do better type-checks so that users don't
accidentally using is checks or have to manually do the right
typeof or instanceof checks. In order to do this, there is
some refactoring to make ExportCreator a SharedInteropTransformer
(as it's shared across all backends) so that we can reuse an
existing visitor. In the same class, we remove unnecessary setting
of parent pointers. We should clean up the fileOffsets as well,
but dart2js verifies that those are set, so we keep them as is
for now. Also adds some static errors for edge cases.

CoreLibraryReviewExempt: Helper for web-specific library.
Change-Id: I34d818ada1349b69afd15d170d3fafa0460f65fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347225
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-01-25 18:52:45 +00:00
Oleh Prypin 0da8f7a7b4 Remove unnecessary imports of 'package:collection' IterableExtension
* Replace `.whereNotNull()` with `.nonNulls` which is now in Dart core.
* `.firstOrNull`, `.lastOrNull`, `.singleOrNull` and `.elementAtOrNull(i)` are also in Dart core and even under the same name, so simply drop the import of 'package:collection' whenever possible.

Bug: b/322159291
Change-Id: I81eb93426680dc78a608bbcc714eb26c0eca5c62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348260
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2024-01-25 11:07:28 +00:00
MarkZ 8edbcacfb0 [ddc] Removing some references to "legacy" DDC modules.
"DDC" is now the accepted name for the module system.

Change-Id: I655219ccc7cff7ff99b1311518ef6ed6e7d1b2a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348085
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-01-24 21:22:25 +00:00
Nicholas Shahan b811ab5b04 [ddc] Reset all initialized consts on hot restart
Clear local caches storing const values in each module.

Change-Id: I7766e92df6b8d1f91bad5fbb2addb8ace7763646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347220
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-22 23:25:18 +00:00
Chloe Stefantsova 970885b879 [cfe] Use TypeParameter in DDCTypeEnvironment, TypeParameterFinder
This CL is a part of the clean up for
https://dart-review.googlesource.com/c/sdk/+/312264

Change-Id: If9d892496af5498943694ad266ee6eb151fdc3e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346401
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-01-17 11:00:17 +00:00
Nicholas Shahan 95cad9c8a6 [ddc] Fix semantics of capturing loop variables
Fixes the for loop lowering to JavaScript when there are function
expressions in the loop initialization, condition, or updates.

Manually assign source mapping information on js_ast nodes to 
make stepping in the Dart debugger make as much sense as possible.
With these mappings three steps are required on each loop variable 
on each iteration but it ensures that the mapping always points to the
variable instead of some random line of code in or around the original
for loop.

Fixes the failure on language/loop/for_variable_capture_test.

Issue: https://github.com/dart-lang/language/issues/3539
Change-Id: I755b88faef11804986fb3d1b2c328da3dd08fe8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345145
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-12 20:04:52 +00:00
Nicholas Shahan 1572bb563f [ddc] Delete typeRep() and legacyTypeRep()
Replaces all uses with the equivalent `TYPE_REF()` and 
`LEGACY_TYPE_REF()` because they are used in the shared dart:_rti 
library and there is no need to support both.

Change-Id: I8c04eb12856cf6933a168f3e63351a45cd5d704e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344608
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-12 00:45:47 +00:00
Nicholas Shahan 1f35476e63 [ddc] Delete compileTimeFlag()
Replaces all uses with the equivalent `JS_GET_FLAG` because it is
used in the shared dart:_rti library and there is no need to support
both.

Change-Id: I4e347d568444caab63e4217845c14353c429cb10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344607
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-01-12 00:12:35 +00:00
Jens Johansen 39d68052a9 [frontend_server/DDC] Expression compilation for JavaScript can pass scriptUri
This allows using the new scope finder and facilitates expression
compilation with and in extension types.

For now the script uri is optional (and only passable in the new json
input via package:frontend_server), and only if the script uri is passed
we'll use the new scope finder.

Flutter etc should be updated to pass the new data.

Change-Id: I36eed1ea76a825e63e4c5b9ea60daf18aee39f3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2024-01-10 10:12:22 +00:00
Nicholas Shahan ced57aa549 [ddc] Handle extension types in more locations
Either erased the extension type or documented why it seems erasure is 
not needed.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: Ic6c2fcaebaf10570691b95a383b8ad2e40d2061a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343720
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-12-27 23:38:42 +00:00
Kallen Tu febdd14b3d [ddc] Add type parameter variance to ddc canary.
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>
2023-12-27 18:19:10 +00:00
Nicholas Shahan e339deff3a [ddc] Cleanup use of Nullability.legacy
These uses all flow to code that ignores the nullability so `.nonNullable`
works just as well.

Issue: https://github.com/dart-lang/sdk/issues/49996
Change-Id: I5363b8f7f757d421866b60c9a9308bf2370f4e50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342723
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-12-19 23:28:27 +00:00
Chloe Stefantsova 3eeba4a4e2 [cfe] Refactor FunctionNode.futureValueType into emitted value type
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>
2023-12-19 08:44:43 +00:00
Nicholas Shahan 38e2d34424 [ddc] Erase extension types in as expressions
Ensures the same optimizations to expressions statically typed as
extension types.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: If85f17203cb4c07c06da0e2e1712fea15c39c444
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342106
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-12-18 20:56:54 +00:00
Nicholas Shahan 8d24f7ebd4 [ddc] Erase extension types in string concats
Ensures the same optimizations to expressions statically typed as
extension types.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: I981859562bdd81cf34bd5ed4160a270e6fdff9f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342105
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-12-18 20:56:54 +00:00
Nicholas Shahan b2cd914227 [ddc] Erase extension types in assertions
Ensures the same optimizations to expressions statically typed as
extension types.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: Id9b944d3f716faf38bb4770eb9b90ccc708056ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342104
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-12-18 20:56:54 +00:00
Nicholas Shahan 83ba9fe0a8 [ddc] Enable new runtime types by default
Fixes: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I7b0cfd70c4ada42e094e6ecbfbd077aebf16a490
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341329
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-12-18 18:35:29 +00:00
Kallen Tu ee3ee59012 [ddc] Re-enable 'variance' experiment flag.
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>
2023-12-14 21:01:10 +00:00
Nicholas Shahan dcb03af9e1 [ddc] Fix legacy type appearing modules migrated to null safety
Since we are no longer testing legacy mode this can be changed to
be non-nullable.

Change-Id: I092b24e055f8fa0f9c183477699a301ffb176660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337920
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-12-13 17:22:41 +00:00
Nicholas Shahan 5530d82467 [ddc] Cleanup unused legacy types
These types are all used in placed where the nullability is ignored
so this is mainly just for sanity sake and in preparation for a future
where the getters/methods no longer exist.

Issue: https://github.com/dart-lang/sdk/issues/49996
Change-Id: I4e6489ea859176e30ee8508ad252f4c9b68159b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337921
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-12-13 16:02:38 +00:00
David Morgan 11e29a7d9e [ddc] Add macro flags, add test coverage for basic compile.
Support and test coverage for other modes to follow.

R=cstefantsova@google.com, jakemac@google.com

Change-Id: Ic715f43317364955b3b2341134cf3cf576cebd00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339321
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-12-12 10:07:42 +00:00
MarkZ 5d4e742a67 Updating dart_library.js to be consistent with its internal version.
Change-Id: Ia90393022cf43a713bf9f6efb36f3f29b13aa456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338422
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2023-12-06 21:50:54 +00:00
Nicholas Shahan 84aa0207cf [ddc] Remove legacy from nullable inference test
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>
2023-11-23 20:03:22 +00:00
Nicholas Shahan a45fc14739 [ddc] Update debugger field signatures
Erases extension types to their representation type for field
signatures. This is the best representation we have at runtime for
the field. Note this isn't necessarily the runtime type of the
field value.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: Ibe064f4fd3829a858fc9fd920e2e91175d9ae0c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336823
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-11-21 01:55:46 +00:00
Nicholas Shahan 30b530bce7 [ddc] Handle Object members on extension types
Erase extension types when deciding to dispatch directly or to a helper
method for Object members.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: I31081bf4ec64a0f667c8d40b08b94773e229ebe1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335601
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-11-17 22:24:37 +00:00
Robert Nystrom 2ee771a4f6 Remove the legacy "_2" tests. \o/
I also cleaned up a bunch of places that referred to them.

Change-Id: I45f68818c892f8620ea04257885ffa3763374bb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335863
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-11-17 20:17:23 +00:00
Nicholas Shahan 385c0063af [ddc] Cleanup extension type erasure helper
A better API is now available from the kernel nodes directly.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: I1b4b36e44292cadc3f9d6c495ae93ae20e0db970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335944
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-11-14 22:26:39 +00:00
Nicholas Shahan f1219f2956 [ddc] Make equality optimizations aware of
extension types. This ensures the same optimizations are applied to
extension types and the representation type they are erased to.

Issue: https://github.com/dart-lang/sdk/issues/49735
Change-Id: I630fc8b68e6e86b81ec85495286719ca39f89d14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335943
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-11-14 22:26:39 +00:00
Nicholas Shahan 60b90b296c [ddc] Add more context to error messages
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>
2023-11-14 21:13:49 +00:00
Johnni Winther 1f86f34c5c [dartdevc] Add id-testing support in ddc
This adds id-testing support to dartdevc and uses it to add a
scope_test for the DartScope created for expression compilation.

Change-Id: I861092e17807190880bd20e4e39e012fbf0cbe53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334220
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-11-10 10:49:56 +00:00
Nicholas Shahan e278c09ab6 [ddc] Erase ExtensionTypes before normalizing
- Update FutureOr normalization to use exhaustive switch statement and
  throw on ExtensionTypes.
- Delete ExtensionTypeEraser in favor of the `.extensionTypeErasure`
  getter provided by Kernel.

Issue: https://github.com/dart-lang/sdk/issues/53566
Change-Id: Id8cd9b85f9f875084080c7c9d0d8b0bb03ee8da7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334780
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-11-08 19:07:38 +00:00