Commit graph

3092 commits

Author SHA1 Message Date
Johnni Winther f17cf33c6d [kernel] Move Pattern nodes to package:kernel
These AST nodes were so far internal to the CFE, but since we need to
move the pattern lowering to the constant evaluator we need to support them in the AST defined in package:kernel.

TEST=existing

Change-Id: Ie6c5f0f8ad75a866c5d965fdf506bc869ffaf654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288241
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-03-13 08:43:07 +00:00
Johnni Winther 04e6f4c282 [kernel] Add VariableDeclaration.isSynthesized
This adds an [isSynthesized] flag to the [VariableDeclaration] the
signal when the variable doesn't correspond to a variable in the
source code.

The name of a variable can only be `null` if it is synthesized.

Partially in response to
https://github.com/dart-lang/sdk/issues/51554

TEST=existing

Change-Id: I94591971f11da09d210c8b25a2d05e22ca05dc62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286961
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-10 11:13:36 +00:00
Nicholas Shahan ecd37e5d83 [ddc] Default native null asserts on in sound mode
This does not necessarily enable the native null assertions by default
everywhere but it is a step on the path to get there.

- The calls to the method that reads this value are only generated in
  sound null safety so even if this is true the checks don't happen
  in weak null safety. Added a warning when the option is enabled in
  weak null safety.
- Many DDC integrations will set the flag manually during the bootstrap.
  That setting still overrides the default value being changed here.

Change-Id: I4459fb8e8928424b461eb5519f3a7dc87c578172
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286606
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-09 23:43:49 +00:00
Mark Zhou a92274cae8 [ddc] Rolling internal dart_library.js into SDK
Change-Id: Ifb1cf1aed53b04eaa0a258668eab6b4b8f19df80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286609
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2023-03-07 19:44:26 +00:00
Nicholas Shahan de44a23dd1 [test_runner] Cleanup unused compiler names
"dartdevc" and "dartdevk" have been replaced with "ddc".

Change-Id: I823bc029a0bbe1295fd731efcc32961e61c6c175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282485
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-07 02:09:16 +00:00
Johnni Winther bd02ce7a7f [cfe] Report error on : for default values
Closes #51576

TEST=pkg/front_end/testcases/general/colon_default_value

Change-Id: Ia8ccdf697d876dbefcbf2c5ed98d01634c075e74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286183
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-06 19:04:55 +00:00
Mark Zhou 36ee2f3adb [ddc] Using fully qualified import URIs for deferred load caching
Change-Id: Ibd4b9e1d37aeb9b2df3414eb52a01400e86c0f42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281562
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2023-02-28 00:12:33 +00:00
Paul Berry c9d4861104 dev_compiler: prep for enabling patterns feature.
Change-Id: I08f2cc23ffd518e23cf8d395884c5e51db26a811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285340
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-27 17:17:42 +00:00
Srujan Gaddam 49f85335d5 Revert "[dart:js_interop] Add literal constructors for inline classes"
This reverts commit 1f6d4ae1a8.

Reason for revert: Broke Flutter with dart2wasm

Original change's description:
> [dart:js_interop] Add literal constructors for inline classes
>
> Adds @ObjectLiteral annotation to denote object literal constructors,
> and implements it in all the backends. For dart2js, this involves
> modifying the SSA and for dart2wasm, we create a one-per-shape
> forwarding procedure to a specialized JS method that returns the
> literal. This also modifies @anonymous semantics in dart2wasm to
> be consistent with the other backends.
>
> CoreLibraryReviewExempt: Backend-specific, just adding annotation.
> Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>

Change-Id: Ifce611e1150d8aa275f9e312743bded56a572176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285342
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-24 20:42:14 +00:00
Srujan Gaddam 1f6d4ae1a8 [dart:js_interop] Add literal constructors for inline classes
Adds @ObjectLiteral annotation to denote object literal constructors,
and implements it in all the backends. For dart2js, this involves
modifying the SSA and for dart2wasm, we create a one-per-shape
forwarding procedure to a specialized JS method that returns the
literal. This also modifies @anonymous semantics in dart2wasm to
be consistent with the other backends.

CoreLibraryReviewExempt: Backend-specific, just adding annotation.
Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-02-23 01:14:39 +00:00
Ömer Ağacan 7c6423cb32 Revert "[kernel] Remove unused RecursiveVisitor type parameter"
This reverts commit a329e05684.

Reason for revert: Broke internal projects

Original change's description:
> [kernel] Remove unused RecursiveVisitor type parameter
>
> TEST=ci
>
> Change-Id: I523282e933b955389c950c1942253d2d66a51f3f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283821
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Ömer Ağacan <omersa@google.com>

TBR=johnniwinther@google.com,omersa@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Iad30e34ce0a491711b0daa1991c69de1796f8846
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284023
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-02-18 10:52:39 +00:00
Ömer Sinan Ağacan a329e05684 [kernel] Remove unused RecursiveVisitor type parameter
TEST=ci

Change-Id: I523282e933b955389c950c1942253d2d66a51f3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283821
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-02-18 07:31:18 +00:00
Devon Carew 0bed5e0398 [pkg/testing] use package:lints/recommended.yaml
Change-Id: If3836cb1758671ccd53bfe2b227b7489a9855fa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283460
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-02-17 01:34:34 +00:00
Mayank Patke aa0a7e7083 [ddc] Add dart.web.assertions_enabled environment variable.
Change-Id: If28f2f1404f02c5d757774188a5a006137c8734f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273284
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-02-14 01:35:05 +00:00
Devon Carew 21ab29fef6 [deps] rev package:source_maps to the latest
Change-Id: Ic0926143ea98bc3bc1eebfaca0d20c3f5578154a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282808
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-02-13 21:18:37 +00:00
Jens Johansen 60183d0dc4 [ddc/testing/cfe/kernel] Wire up leak testing in ddc batch testing; fix 'semi-leaks'
There's been some talks about weird failures on DDC and there was
ideas that this was caused by some sort of leak (of kernel libraries).

I haven't really found any "meaningful" leaks that should be able
to cause that.

What I have found is this:

* a temporary leak where the vm seemingly gets "one behind".
  That's fixed here by creating a class for the ddc batch compiler,
  having things in field variables etc. It shouldn't influence results.
* a leaks via https://github.com/dart-lang/sdk/issues/51317 --- but
  that's just wasted memory, I can't see how that should influence
  results.
* a leak via kernels dummy nodes --- again it shouldn't influence
  results (unless we're leaving dummy nodes in the output somewhere
  --- which, considering I'm removing that in my test by null'ing out
  the parent pointer and stuff still working I'm guessing we're not).
* another leak via some ports map after a crash, but that seems
  to go away on its own (the VM cleaning it up later than I think it
  should?). Again it shouldn't influence anything other than
  (temporary) wasted space.

I've wired up the leak testing stuff into the DDC batch mode so that
one can go into "leak test mode" by doing `export DDC_LEAK_TEST="true"`
on the terminal (I think `set DDC_LEAK_TEST="true"` on Windows).
Then one could run test.py, say

```
python3 tools/test.py -t10000 -c dartdevk --nnbd weak -m release \
  -r none --enable-asserts --no-use-sdk -j 1 co19/LanguageFeatures/
```

and attach the leak tester via

```
out/ReleaseX64/dart \
  pkg/front_end/test/vm_service_for_leak_detection.dart --dart-leak-test
```

Currently this finds - if I recall correctly - 3 leaks (I think all via
the ports map stuff), but it all goes away again on it's own, so likely
another case of the VM somehow getting "one behind".

Change-Id: Idbf057e3aedfe7b256370f90ddf72f1f8e6798a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282027
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-10 08:29:37 +00:00
Srujan Gaddam e6e1040afc [dart:js_interop] Expose dart:_js_interop
Types still need to be sealed, so this library is exposed with a
disclaimer that users should not subtype any types.

CoreLibraryReviewExempt: Backend-specific library for JS and Wasm.
Change-Id: I2ed8b0db6b2de60932a551047c6c9eae4a34ce2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281343
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-10 01:41:50 +00:00
Alexander Markov d7e4ad02d7 [kernel] Cleanup Target.enableSuperMixins flag
This flag is no longer used by the front-end and can be removed.

TEST=ci

Change-Id: Ia19e9927d48d4ae486ee7ffa110abb9960a0840d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281461
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-09 16:17:11 +00:00
Joshua Litt bd79be0e19 [js] Move allowInterop functions to dart:js_util.
CoreLibraryReviewExempt: Has core library owners approval.
Change-Id: Iea2f2e707c69c9082e158b48b50dcaf4a7b01067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279740
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-08 17:16:20 +00:00
Joshua Litt 99a9f3d516 [js_types] MVP of JS types.
Change-Id: Ic329146a270ff32fc2cdb32febc6f574bc81792f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280131
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-02 21:29:01 +00:00
Alexander Markov a9d9b7395b [kernel] Enable sound null safety in TargetFlags by default
TargetFlags.enableNullSafety is set to true by default and
also renamed to TargetFlags.soundNullSafety to better reflect its
meaning.

TEST=ci

Change-Id: I2c2f30c2af6502fd9a96141dc60e4afbf8c524fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280216
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-02-02 14:54:18 +00:00
Anna Gringauze 6387f7345a Fix incorrect record types
- Access record elements starting from 1 when creating record type.
- Add record tests for the expression compiler.

Closes: https://github.com/dart-lang/sdk/issues/51197
Change-Id: I02af94a1f09cbcb9801b6b3a5b0effdfd33aab2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280204
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-01 01:56:38 +00:00
Josh Soref 77978889eb Spelling
Closes https://github.com/dart-lang/sdk/pull/51143

GitOrigin-RevId: 9e21c99a222d588e4fc95980725a2f8c9784965c
Change-Id: If0870e8936c7649935dce7e23cd783d62aa5610c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279916
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-30 18:29:59 +00:00
Ahmed Ashour 63180b95ed Remove superfluous words.
Fixes #51095

TEST=ci

CoreLibraryReviewExempt: There are no API changes, just removal of superfluous words in the comments.
Change-Id: Ib1020c62fe6baed5ca68f0074323f025cc90e9f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279500
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-01-30 15:58:38 +00:00
Lasse R.H. Nielsen bee7ab2b32 Make record positional field getters start at $1.
An update for co19 is available at https://github.com/dart-lang/co19/pull/1759

TEST=Existing tests run after change, two new tests for edge cases.

Change-Id: I408e398d532ba2c2e8e60777bb4f7bd0057e27fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278912
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-30 08:14:28 +00:00
Nicholas Shahan 7c5445074b [ddc] Refactor modular test suites
- Move DDC modular pipeline to helper library.
- Add null safety flag to `SourceToSummaryDillStep`.
- Add null safety and canary mode flags to `DDCStep`.
- Add new suite that runs in canary mode without sound null safety.

Change-Id: I3b5450c2f07913a8bdc9a210e16d26fe162ff1c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279478
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-27 23:57:30 +00:00
Nicholas Shahan fa8c14a3e3 [ddc] Add scope offset test in sound null safety
Change-Id: Ic050932eb5a082330a18d4aeaefb106cbd2819ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279907
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-01-27 00:32:38 +00:00
Nicholas Shahan d56b9b3988 [ddc] Remove unsound .dill files from SDK
Dart 3 requires all code to be null safe.

Compiling with --no-sound-null safety requires manually passing
an unsound SDK outline. This is no longer provided by default
and is not packaged with the SDK at all.

Fixes: https://github.com/dart-lang/sdk/issues/50700
Change-Id: Ic4bd7dc5e96b42c7c10a29f273371c6a680936f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278999
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-26 22:34:38 +00:00
Nicholas Shahan 5b1e6ca6c6 [ddc] Cleanup sourcemap and stacktrace tests
- Remove all refrences to "ddk" vs "ddc".
- Update throw_in_instance_method to reflect the current sourcemappings
  and start running the test again.

Change-Id: Iff82f971e676346b3495a327d2d86cabd73cea03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279473
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-26 21:43:18 +00:00
Nicholas Shahan 41f57cd3f8 [ddc] Cleanup names of modular tests
Fix names in test matrix to match what is actually running on
each bot.

Updated file names:
- Runs with sound null safety
  modular_suite_nnbd.dart -> modular_suite.dart

- Runs without sound null safety
  modular_suite.dart -> modular_suite_unsound.dart

Updated configs to record status:
- Sound
  dartdevk-strong-linux-release-chrome
- Unsound
  dartdevk-checked-linux-release-chrome
  dartdevk-checked-mac-release-chrome
  dartdevk-checked-win-release-chrome
  dartdevc-canary-weak-linux-release-chrome-x64

Change-Id: I21d1df41a174824b26154584315cb300a37103f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279471
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-26 20:18:39 +00:00
Josh Soref 01b28894e7 Spelling pkg dev compiler
Closes https://github.com/dart-lang/sdk/pull/50861

GitOrigin-RevId: 71005e6f5bf5a151cb5c1aefb6a2a300fc40f592
Change-Id: Iadfafb5787a62e9a379437f6a3763d31f99ba7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277743
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-26 09:12:41 +00:00
Nicholas Shahan 9bddc9c88d [ddc] Cleanup old error message
This message was added to assist in the transition from the analyzer
to the CFE based version of DDC. Old versions of build_web_compilers that would pass analyzer summaries no longer version solve with this
SDK version.

Change-Id: Ie34b2c21b615a0978d6089567458827fe2ddb0f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279235
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-24 01:14:07 +00:00
Nicholas Shahan 1b2ecbda40 [ddc] Cleanup JavaScript files in packaged SDK
- Removes all versions of `dart_sdk.js` and `dart_sdk.js.map` from the
  packaged SDK. All supported build systems compile their own versions
  of these files.
- Removes `dart-sdk/lib/dev_compiler/kernel/common/run.js`.
  No supported build system uses the "common" module system.
- Moves `dart-sdk/lib/dev_compiler/kernel/amd/require.js` to
  `dart-sdk/lib/dev_compiler/amd/require.js` cleaning up the
  unnecessary `kernel/` sub-directory.

Issue: https://github.com/dart-lang/sdk/issues/50700

Change-Id: Id4173ddec31a6c0260009924bf1e1ae3d3f32abf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275482
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-18 01:34:57 +00:00
Nicholas Shahan c140324e1e [ddc] Rename .dill files
- Makes the names consistent with dart2js and dart2wasm.
- Prepares for the upcoming removal of the weak null safety .dill file.

Change-Id: Idcf694b27cd4731db8f7ed6f0fdab7766ced08a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277183
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-01-18 01:34:57 +00:00
Srujan Gaddam 572d545c72 [dart:_js_interop] Add dart:_js_interop
Adds dart:_js_interop for use in the web backends. This library
only exports dart:_js_annotations' @JS for now. In the future,
we'll add more to this library and mark it public. Also refactors
some tests to use dart:_js_interop.

Change-Id: I7b60c950a39038a586756b7c9c10c6e31f1ab4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278694
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-01-16 22:31:33 +00:00
Srujan Gaddam b9002bfe55 [ddc] Inline js_util transformation methods
There are a number of js_util methods that we use for transformations e.g.
_getPropertyTrustType. In order to avoid unnecessary method calls, we inline
them directly in DDC here. This includes:

- _getPropertyTrustType
- _setPropertyUnchecked
- _callMethodUnchecked*
- _callConstructorUnchecked*

Change-Id: I7f6905ec1daadcf5228eafde4fda5d435d6c8b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277661
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-16 22:31:33 +00:00
Srujan Gaddam bb2092368c [pkg:js] Lower external top-level package:js members
Lowers top-level external package:js members to their respective
js_util transformation, taking into account any namespacing in the
member's name. We only do this transformation for code that uses the
@JS annotation from dart:_js_annotations and isn't from dart:ui. This
is to avoid a breaking change for Dart 3. As such, we allow
dart:_js_annotations to be used in some test paths. In the future, we
will export the dart:_js_annotations @JS annotation through
dart:js_interop instead.

Change-Id: I3b92a3a8cd1340c50913b9df6fdc743e2790259e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277048
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-16 22:31:33 +00:00
Nicholas Shahan 8e1f57666e [3.0 alpha][ddc] Remove unused command line args
The `-k`, `--kernel`, and `--dart-sdk` arguments have been
ignored since v2.8.1.

Change-Id: I28e793f3e2023cc09c279ca65d08295b1ed11028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276771
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-03 20:14:12 +00:00
Nicholas Shahan c5dc693919 [ddc] Enable null safety by default
The `--no-sound-null-safety` can still be passed explicitly to compile 
with weak null safety.

Change-Id: If77eb58c77f63bb53a62d62c153c39de903d4525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276764
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-01-03 18:57:49 +00:00
Nicholas Shahan b84aa5a7f9 [ddc] Cleanup uses of ignored cli args
The `-k`, `--kernel`, and `--dart-sdk` flags are ignored by DDC.

Change-Id: Ic2bf5c87a26cab7dcbcfeafa39dae1ea1b20c711
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277180
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-22 21:50:08 +00:00
Nicholas Shahan b9469f452a [ddc] Always explicitly pass null safety mode
Add explicit mode flags for DDC related compiles.

Change-Id: Icb9e21a4b8786a0de620bcc387cafbe8d27d0e86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277042
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-12-21 23:35:45 +00:00
Johnni Winther 81845864ca [kernel] Rename View* to Inline*
TEST=existing

Change-Id: I8726c936261ceb770b489f264d14fff02a1b4998
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275243
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-12-14 08:36:57 +00:00
Nicholas Shahan 0b3533aa95 [ddc] Fix unsound await expressions
Some expressions have a static type that can lead to a possible
soundness issue when awaited. For those expressions an additional
runtime check is performed.

Issue: https://github.com/dart-lang/sdk/issues/49396
Fixes: https://github.com/dart-lang/sdk/issues/50602
Change-Id: Ief25fbe8c38330cca0c17be4d411780a20ab87a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274729
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-12 19:43:55 +00:00
Brian Wilkerson de24bf1cce Remove some unnecessary ignore comments in dev_compiler
Change-Id: Ibb901e1e9d02d0480721240d4d5ecef070364135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274726
Commit-Queue: Leon Senft <leonsenft@google.com>
Reviewed-by: Leon Senft <leonsenft@google.com>
2022-12-09 22:45:58 +00:00
Srujan Gaddam 293ae7dabe [ddc] Add interop classes for static members
Fixes https://github.com/dart-lang/sdk/issues/46967

Creates classes for non-external factories and static members, and
modifies invocations to point to these members instead. Tear-offs of
interop constructors (external or otherwise) are now supported since
they're just non-external static methods.

Change-Id: Id754fb4bc872051a8df4169aefd4bdc078452fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270501
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-12-08 04:57:50 +00:00
Nicholas Shahan 1edc2ecd3f [ddc] Support warnings/errors in weak mode
In the new runtime type system when running with weak null safety,
perform type tests multiple times to produce optional warnings or
errors when a test passes but would fail in sound null safety.
This is the same technique DDC uses with the current type system.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ic1514987a6f4ffeb127a0d2be5ec15b606016212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266543
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-08 00:52:18 +00:00
Anna Gringauze 3bb1323b92 Reland "Cache expression compilers in incremental DDC mode"
- Fix ddc null dereference while generating symbols with mixins
- Fix incremental compiler failure on non-SCC components
- Reworked expression compiler worker tests for effiiciency
- Create module configuration in tests only once
- Add test case of compiling expression in an non-SCC module
- Add test case of compiling expression in an SCC module

This is a reland of commit e6f779bcdd

Original change's description:
> Cache expression compilers in incremental DDC mode
>
> - cache expression compilers in expression compiler worker
>   to improve performance of exression compilation.
> - pass module format in expression compiler worker
>   (the ddc format tests were not running!)
> - fix an issue where the same library was imported twice
>   in module_builder.dart
> - add verbose mode timeline logging to ProgramCompiler.
> - update tests.
>
> Closes: https://github.com/dart-lang/sdk/issues/49944
> Change-Id: Ie7408dcd42e757b1eb5e7f5ccbc1b078b6417011
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268361
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>

Change-Id: I80546773d957f37ec5b2353ea060b50f3fba0aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271801
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2022-12-05 18:39:17 +00:00
Nicholas Shahan a464fc354b [ddc] Support more complicated subtype checks
Generate type hierarchy rules for all interface types used in a
module. These rules are utilized by the `isSubtype()` to determine
interface subtypes.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I63f64075d4947f234eca5e730ad15588e60b9e1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266542
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-03 00:37:41 +00:00
Mark Zhou 4a5eff63d7 [ddc] Emitting nullability wrappers for records
Change-Id: I032e5cf915a70b44559a8269e22ab2dbedb9726a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272740
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-12-01 18:04:18 +00:00
Nicholas Shahan 2cbed01634 [ddc] Avoid null check on forwarding field setters
Overriding fields can change the type to remove nullability and
can also be final so they override the getters only.

For DDC that means there is an inherited setter that could still be nullable and a forwarding setter that should allow null even though
the type of the overriding field is non-nullable. With enhanced null
safety asserts enabled in weak mode there should be no failure when
setting the inherited field to null.

Fixes: https://github.com/dart-lang/sdk/issues/50569
Change-Id: Ie6af0d1e265a5f3b15469311fa1f7e2a184d95ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272480
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-29 21:49:15 +00:00