Commit graph

22531 commits

Author SHA1 Message Date
Aske Simon Christensen b686b2e948 [dart2wasm] Support constants and comparison for Wasm numeric types
CoreLibraryReviewExempt: Only modifies Wasm-specific files.
Change-Id: Ibf1d466e37de6d5f0e77c5ce7abde45a1f085617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287981
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-13 14:16:08 +00:00
Robert Nystrom 56eaffb392 [flip-patterns] Enable "records" and "patterns" experiment flags.
This turns on the flags for these two language features and makes
them generally accessible.

Doing so causes a number of tests to fail, but the failures are
approved and there are filed issues for them. Most of the
failures are minor or only affect code using the new language
features.

This CL:

- Enables the features in experimental_features.yaml.
- Re-generates all of the various files generated from that.
- Makes some analyzer and front end changes that this CL
  inherited from Paul's original CL flipping all of the 3.0
  feature flags. I don't know what these changes are about, but
  I assume they are necessary.
- Pins a couple of tests to 2.19 since they deliberately test
  behavior that is specific to 2.19. (For most test changes, I've
  landed them separately, but there are a couple of stragglers
  in this CL.)

This doesn't enable "class-modifiers" or "sealed-types" and doesn't
include the core lib changes related to those.

TEST=On bots

Change-Id: Id387753772286a958e20a3589a6e983995f2e4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286344
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-10 20:02:23 +00:00
Ben Konyi f51fedce26 [ dart:developer ] Remove Metrics related classes
Fixes https://github.com/dart-lang/sdk/issues/51668

TEST=CI

CoreLibraryReviewExempt:VM only functionality
Change-Id: I5d41863fca05e50d9c20266402c516b92f8de153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287820
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-10 16:50:10 +00:00
Leaf Petersen 34531dcdf2 Tests for mixin class legacy interactions.
Change-Id: I2d2c3353f77b96d656bc81dc5f59bd7021ed2861
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287665
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-03-10 06:02:34 +00:00
Jake Macdonald 737b6f7356 [flip-modifiers]: flip the flags for sealed classes and class modifiers
Includes several updates to tests that needed to land with this flip, as well as some other tests that needed to be updated and could land separately, but are being included here to expedite things.

Removes some unnecessary experimental release versions, as well as bringing up to date the generated files, which were previously out of sync with the yaml file.

TEST=bots

Change-Id: I71a86d7a86190069b504bd27d687f62b97a7251e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285080
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-03-10 05:27:57 +00:00
Robert Nystrom d52fe19dee Add tests for non-primitive equality in switch cases.
Even when a switch case only contains a constant (and not some more
complex pattern), Dart 3.0 changes the semantics and allows constants
of types that don't have primitive equality.

Add some tests for that.

Change-Id: Id3578d017822695451d7e44590fa349a8191a310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287663
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-03-10 02:39:28 +00:00
Aske Simon Christensen c19720245c [dart2wasm] Categorize and masquerade runtime types by lookup table
This avoids virtual calls for `runtimeType` (unless the user overrides
it) and `_runtimeType` (since the internal categorization is now done
using the table instead), which saves a huge amount of space in the
global dispatch table.

It also fixes record runtime types, which now use the masqueraded
types for its fields, rather than the (possibly user-overridden)
`runtimeType`.

A masquerade case was missing for `Type`, which has been added.

Fixes https://github.com/dart-lang/sdk/issues/51134

Tested: ci + new test for overridden runtimeType
Change-Id: I1909c665ae78eb07b9c0eb22b6e8836e27495d70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285684
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-09 22:08:19 +00:00
Lasse R.H. Nielsen c974c70f31 Add boolean parse
Closes https://github.com/dart-lang/sdk/pull/51026

Co-authored-by: Renato Burton <renatoburton96@gmail.com>
GitOrigin-RevId: e85a56ce338476b38eac890fac2b8ca193ca42e8
Change-Id: I60f92c594830ef0438ecd92b4c83cec609054326
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279746
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-03-09 15:14:32 +00:00
Oleh Prypin 732d1cc0a4 Revert "Add more interface and final modifiers to dart:core."
This reverts commit 4f8333e80e.

Reason for revert: causes breakages in google3

Original change's description:
> Add more `interface` and `final` modifiers to `dart:core`.
>
> Make intent explicit for classes which are intended as interfaces,
> or which are not intended to be subclassed.
>
> Mainly classes which are pure interfaces are marked as such,
> and platform-specific classes not intended for subclassing
> are made `final`.
>
> The `final` classes includes `BigInt`, which is written to assume
> that arguments inherit its private members
> (it runs `_ensureSystemBigInt` on arguments).
>
> It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
> which are just intended as stand-alone implementation classes for accessing
> platform-specific functionality.
>
> Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I94ff95f72410a4e1ae80744971c4c920fecc1493
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-09 13:09:57 +00:00
Lasse R.H. Nielsen 4f8333e80e Add more interface and final modifiers to dart:core.
Make intent explicit for classes which are intended as interfaces,
or which are not intended to be subclassed.

Mainly classes which are pure interfaces are marked as such,
and platform-specific classes not intended for subclassing
are made `final`.

The `final` classes includes `BigInt`, which is written to assume
that arguments inherit its private members
(it runs `_ensureSystemBigInt` on arguments).

It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
which are just intended as stand-alone implementation classes for accessing
platform-specific functionality.

Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-09 12:31:08 +00:00
Robert Nystrom 2496c1a69a [flip-patterns] Fix web switch tests.
Update two tests to Dart 3.0 semantics:

- Switch case constants can be types that don't have primitive equality.
- Switch cases don't need breaks.

Change-Id: Icdea5b66cf12f675580a85b9d49c09db589e29d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287400
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-03-09 01:13:09 +00:00
Ömer Sinan Ağacan 979e8dc932 [dart2wasm] Fix instantiation closure equality
The test fails in VM, which is reported as #51660.

Change-Id: Icb0f5493f282aa017980478a038b48dd09c5030c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286933
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-03-08 15:42:26 +00:00
Martin Kustermann 91ea353298 [gardening] Make new standalone/io/exit_works_with_blocked_isolate_test be a nop in the training run
TEST=Fixes standalone/io/exit_works_with_blocked_isolate_test in app-jit mode

Change-Id: Icd4f43dfe524b5a9f8569a520a661289214bfddf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287461
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-03-08 10:22:46 +00:00
Joshua Litt 25779cc933 [js] Ensure dartify / jsify have inverse semantics.
CoreLibraryReviewExempt: Minor change to the internal of a web backend specific API.
Change-Id: I450e9410af7e006b853e2d8f26dc5ede1d95f4e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245621
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-08 00:07:42 +00:00
Ryan Macnak 219c4140b5 [vm] Add test that dart:io.exit should work even if isolates are blocked.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51560
Change-Id: I6634594a19b746a9bc4c70de58e475576372eb4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287002
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-07 17:53:27 +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
Robert Nystrom 91ef5b252b [flip-patterns] Update invalid assignable expression test expectations.
With pattern assignment, the error messages are now different in 2.19
libraries since a parenthesized expression looks like you might be
trying to do a pattern assignment.

Change-Id: I00105ea4cb5dbe8c8b328fb2e665200f3dc33722
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286870
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-06 21:57:51 +00:00
Jake Macdonald af6e1bf5a4 [flip-modifiers]: prep more tests for the class modifiers flag flip
TEST=only test changes

Change-Id: I725bd897e9e749ab6010c99ee74c20ee64e61500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286981
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-06 20:52:03 +00:00
Joshua Litt c36862af90 [js] Specialize optional arguments at call sites.
Change-Id: I59b10242a5d85907c21fc99eaf1eff15b39d7191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285701
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-06 19:59:32 +00:00
Robert Nystrom 872422fa22 [flip-patterns] Update switch tests now that break is no longer required.
Change-Id: If32a8133f89a0ee5e0961657b8fc461b30561226
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286869
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-06 15:48:25 +00:00
Robert Nystrom e8d44461ce [flip-patterns] Update language/constants_2018/equals_test.dart for primitive equality.
We've changed const `==` to be based on primitive equality. It used to
just be an allowed list of concrete types, but now `==` is a valid
constant expression on any type that has primitive equality.

This change isn't directly part of patterns, but is enabled under the
same flag.

Update this test to the new semantics.

Change-Id: I484bd09f5775319dc49038d70a244c3c1564fe93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286865
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-03-03 23:39:37 +00:00
Ömer Sinan Ağacan 8dbf923e89 Remove invalid inequal tear-off hash code test
`hashCode` requires that equal objects have the same hash code.

However it doesn't (and cannot) require that inequal objects have
different hash codes. Remove the invalid check.

This makes the test pass on dart2wasm, which currently implements
closure hash code as:

    // Simple hash code for now, we can optimize later
    @override
    int get hashCode => runtimeType.hashCode;

Note: this change alone does not make the whole file pass with
dart2wasm, there's another (unrelated) issue which will be fixed
separately.

Change-Id: Ibc83aee13fdbe48d1b2f7d8e720766b455c6b930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286783
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-03-03 11:07:50 +00:00
Lasse R.H. Nielsen cc736dfb65 [flip-modifiers]: Reapply "Enforce current library restrictions."
This reapplies commit 0c05e33836
and reverts the revert 029e0cec71.

Tested: Added few new tests, updated existing. Mainly regression testing.
CoreLibraryReviewExempt: Reviewed in original CL.
Change-Id: Ifcc79ce2f9375f607722643a04957b0961e6c295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284304
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 09:37:38 +00:00
Ryan Macnak e31c3713bf Reland "[build, vm] Access TLS with less code."
- Avoid TLS initialization checks by using inline initialization.
 - Avoid global offset table indirection by reducing -fPIC to -fPIE.

out/ReleaseXARM64/exe.stripped/dart_precompiled_runtime
11137992 -> 11274776 (-1.21%)

We still need -fPIC in some places because we build a few shared libraries for FFI, so copy some of Fuchsia's GN setup to use -fPIE or -fPIC as appropriate.

Account for older gcc that does not default to -fpie.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51602
Change-Id: I85072153cb1aef9047c1adbf36c7496fbeb11e10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286221
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-02 23:07:16 +00:00
Jake Macdonald 3643e771c4 [flip-modifiers] opt out from class modifiers some failing front end language tests
Change-Id: I7c6473b2c1dd401355b18b55c8d3ce9b0cfaf257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286541
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-02 20:40:20 +00:00
Jake Macdonald 7910eac426 [flip-modifiers]: opt out failing ddc tests from class modifiers
Change-Id: Ib9187cd63be39b155cd78b1e213b1a5e9cdb3be9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286560
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-02 20:27:25 +00:00
Alexander Markov e27923a5a0 [dart2js] Static weak references to method tearoffs
TEST=language/static_weak_reference_test
TEST=language/static_weak_reference_error_test

Bug: b/269223463

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I760476a7c81751f6c302f21251b525cb5c916c02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284489
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-02 20:04:19 +00:00
Jake Macdonald b83359599e [flip-modifiers]: prep dart2js language tests for class modifiers flag flip
Change-Id: I3eccd65b982628fa9775a94b1ac61b48d8732f80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286540
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-02 19:09:45 +00:00
Daco Harkes 8218ee0840 [cfe/ffi] Fix Finalizable in for( in ) loops
The `Finalizable` visitor was visiting for-in loops in AST order:
(1) variable, (2) iterable, (3) body. This caused the `variable` to be
fenced in the `iterable` expression. The `variable` should only be
fenced in the `body`.

TEST=tests/ffi/regress_51538_test.dart
TEST=pkg/vm/test/transformations/ffi_test.dart
     with pkg/vm/testcases/transformations/ffi/regress_51538.dart

Closes: https://github.com/dart-lang/sdk/issues/51538
Change-Id: Idacf87b6de3ee0d2d5c6c5046060c55135593fed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286182
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-03-02 09:05:19 +00:00
Konstantin Shcheglov ad15774558 Issue 51567. Implement constant equality as primitive equality
Bug: https://github.com/dart-lang/sdk/issues/51567
Change-Id: I7821598a761573519205b0ea06b13f433639282b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-01 20:58:57 +00:00
Jake Macdonald bc3a4a660f pre-emptively fix some tests for class modifiers flag flip
Change-Id: Ie7bbea5faa07dcc41f551268bd730bf0416e1fef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286280
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-03-01 20:11:25 +00:00
Kallen Tu 22de5b34f2 [cfe] Report an error when a subtype of a base or final type is not base, final or sealed.
Change-Id: I54c9e3edcc0ae7e61f48ff7e3b42d83e0556af7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286101
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-01 19:10:56 +00:00
Kallen Tu 4f6ccd9fee [analyzer] Report an error when a subtype of a base or final type is not base, final or sealed.
Change-Id: Ie9c943e6ce7d3b1c746ccd4ee3757886dd619c5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285441
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-01 19:01:59 +00:00
Alexander Markov 8627463c23 [tests, benchmarks] Reformat using new Dart formatter
Certain tests and benchmarks are reformatted using the new version of
"dart format" which supports records.

TEST=ci

Change-Id: I6132e8000317bfcc56c8d96682dc9771c728076d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286201
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-01 18:15:09 +00:00
Stephen Adams cfa6d0f735 [dart2js] Fix #51558 - skip abstract getters
Improve 'enum switch' optimization to not be confused by abstract
getters.

Bug: 51558
Change-Id: Iac4e5238c1884df6afd1611aecc9f158b1a8b167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286102
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-03-01 16:41:38 +00:00
Robert Nystrom 7ca5ad46ce Set tests that have mixin errors as 2.19.
Mark tests that contain errors about using a class as a mixin to use
language version 2.19 where that's not an error.

This may not fix all of the tests because it's the language version of
the library where the class is declared that matters, not where the
class is used as a mixin. But most tests have all of their declarations
in the same library, so this should fix most.

Change-Id: I910439ebd2f10f731418dc588b7e4619a0841c16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285923
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-01 15:03:39 +00:00
William Hesse ec53fdd0bf Revert "[build, vm] Access TLS with less code."
This reverts commit aa79cf2708.

Reason for revert: -fPIC is needed in more places than the CL adds it to, see CI builds at https://ci.chromium.org/ui/p/dart-internal/builders/ci/dart-sdk-linux-riscv64-dev/405/overview

Original change's description:
> [build, vm] Access TLS with less code.
>
> - Avoid TLS initialization checks by using inline initialization.
> - Avoid global offset table indirection by reducing -fPIC to -fPIE.
>
> out/ReleaseXARM64/exe.stripped/dart_precompiled_runtime
> 11137992 -> 11274776 (-1.21%)
>
> We still need -fPIC in some places because we build a few shared libraries for FFI, so copy some of Fuchsia's GN setup to use -fPIE or -fPIC as appropriate.
>
> TEST=ci
> Change-Id: I6402fce3366a9c4b2741ffb4811562292b8ecb71
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285704
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

Change-Id: Idacb7869e9fa9ad0f7ed7b0caa2bae19deece7d0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286144
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: William Hesse <whesse@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-01 12:19:07 +00:00
Daco Harkes 08b57e0457 [test/ffi] Fix test use RTLD_GLOBAL on Android
Android arm has a different const for `RTLD_GLOBAL` which we take care
of in the helper function `dlopenGlobalPlatformSpecific`. So use that
instead.

Change-Id: Icb5d0b84f7d76ec1f6e24d43a644cffe8f46fd42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286140
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-01 10:24:24 +00:00
Daco Harkes cb1b6905ac [vm/ffi] Fix @Natives with VarArgs
This CL fixes the processing of `@Native` annotations to take into
account the native types nested in `VarArgs`.

TEST=tests/ffi/regress_51504_test.dart
TEST=tests/ffi/function_varargs_generated_native_leaf_test.dart
TEST=tests/ffi/function_varargs_generated_native_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51504
Change-Id: Ifb0a08e1e52c9b51cb5143e7ac487a91da4a0e0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285623
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-01 09:08:31 +00:00
Ryan Macnak aa79cf2708 [build, vm] Access TLS with less code.
- Avoid TLS initialization checks by using inline initialization.
- Avoid global offset table indirection by reducing -fPIC to -fPIE.

out/ReleaseXARM64/exe.stripped/dart_precompiled_runtime
11137992 -> 11274776 (-1.21%)

We still need -fPIC in some places because we build a few shared libraries for FFI, so copy some of Fuchsia's GN setup to use -fPIE or -fPIC as appropriate.

TEST=ci
Change-Id: I6402fce3366a9c4b2741ffb4811562292b8ecb71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285704
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-03-01 01:21:55 +00:00
Kallen Tu efc9ebb215 [cfe] Change location of mixin class constructor errors.
Change-Id: Ic9484ca8ccadba8f13588e4e7f5fa781344c27b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285881
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-28 16:46:29 +00:00
Robert Nystrom 51bc545135 Switch cases are no longer const contexts with patterns.
But there is a new "const expression" pattern syntax that does
introduce a const context, so test that here instead.

Change-Id: Iaf615093c3d2fb32065fa8647bf3663118b0c274
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285761
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-02-28 01:34:26 +00:00
Jake Macdonald 89e9f1ea9b opt out static interop inheritance test until classes can be marked as mixin classes
Change-Id: I006f7ea206da64c30acd070e2ed83ec786def1fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285802
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-02-28 00:25:49 +00:00
Jake Macdonald 41bc0b4d07 opt assignable_expression_test into 2.19
opt switch related tests back to 2.19
opt map/set hashCode override tests back to 2.19

Change-Id: Ib5c44fc17de43eaf9bcad71d7a326c5fcbff02bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285800
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-02-27 22:48:51 +00:00
Paul Berry 7e5297e5f8 Enable the fallback exhaustiveness algorithm (with improvements).
This change improves the fallback exhaustiveness algorithm so that it
also takes advantage of the old, pre-patterns exhaustiveness logic for
enums.  This ensures that the fallback exhaustiveness algorithm won't
seem like a regression to users who are used to the old pre-patterns
behaviour.  This required extending the old algorithm to handle
new-style switch statements (which have a different representation
from classic switch statements in the CFE) as well as switch
expressions.

We also turn on the fallback exhaustiveness algorithm by default.
Unit tests can still disable it by temporarily setting the global
variable `useFallbackExhaustivenessAlgorithm` to `false`.

The hope is that this algorithm will be short-lived; we are just using
it so that if we decide to enable pattern support in the near future,
users will experience something that is sound.  That is, it may
require `default` or `_` cases more often than is strictly necessary,
but it shouldn't ever allow a non-exhaustive switch in a place where
an exhaustive switch is required.

Change-Id: I4a8b7f996b109c4ee8832f286c3b3bf3b216fe8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284840
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-27 17:36:02 +00:00
Alexander Markov b285115893 [tests] Fix expectations in language/async_star/async_star_await_for_test
According to the language specification:
1) When 'break' is executed in the 'await for' loop (in 'main'),
the underlying stream subscription is canceled.
2) When async* function ('consume') has stopped at 'yield' or 'yield*',
and the stream is canceled, the 'yield' / 'yield*' statement returns
without an object. It also means that code in 'consume()' after
the loop is not executed and it doesn't append ")" to the log.
So the test expectations are fixed to avoid expecting trailing ")"
at the log when there is a 'break' out of the 'await for' loop.

Fixes https://github.com/dart-lang/sdk/issues/51097

Change-Id: Ia59e87ef84dcb8a0c06a47f497cc97d4c6635d27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285343
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-02-27 16:25:50 +00:00
Konstantin Shcheglov c90821350e Issue 50672. Update flatten()
Bug: https://github.com/dart-lang/sdk/issues/50672
Change-Id: I2747b9c071aa0074f2b26cea33b8d0f11ac61e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274734
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-02-24 22:55:17 +00:00
Daco Harkes 579d964406 [test/ffi] Beef up @Native testing
We only tested a handful of native signatures for `@Native`s and
`@FfiNative`s. This CL duplicates the generated FFI call tests which
cover a lot of signatures to also run for `@Native`s.

Bug: https://github.com/dart-lang/sdk/issues/47625
Change-Id: I475f028c79e13470c2ea4e24040209a915631779
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-win-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284901
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-24 21:16:50 +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
Kallen Tu cef1fab383 [tests] Avoid running backend tests on mixin_class_generative_constructor_error_test.
Change-Id: If1eaca1705f27f6a5df199e292a27d610e09495b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285021
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-02-23 22:53:18 +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
Kallen Tu b34f480e0d Reland "[analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed."
This is a reland of commit f17e9732c5

Original change's description:
> [analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed.
>
> Change-Id: Ia1393851dffaab55c31d04d4e81bfae83a7bd67f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283126
> Commit-Queue: Kallen Tu <kallentu@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: Ic8185f38477b2eeff624ee391868d7260e0ed4cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284486
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-22 22:18:51 +00:00
Alexander Markov 143e4e9dc8 [vm/aot/tfa] Static weak references to method tearoffs
TEST=pkg/vm/testcases/transformations/type_flow/transformer/weak.dart
TEST=language/vm/static_weak_reference_test
TEST=language/vm/static_weak_reference_error_test

Bug: b/269223463
Change-Id: I23c8229c39217aa1c3f9fb576d8eefa5ceb1d8ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-02-22 01:01:29 +00:00
Kallen Tu 16b1c12619 [analyzer] Disallow classes to be used as mixins even inside the library.
Change-Id: I62aaf972a16cdd678f5711a41dc1652b89d0be37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283131
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-21 19:32:44 +00:00
Lasse R.H. Nielsen 164f8588d6 Optimize LineSplitter.
Avoid quadratic behavior when multiple chunks fail to
have a line break, and the carry-over string gets repeatedly extended.

In the original chunked conversion code, the chunk handling code retained the trailing, non-line-terminated text of the previous chunk, then eagerly concatenated it with the next chunk in order to continue looking for lines. That's moderately effective when lines are shorter than chunks, and neither are too large.
However, a very long line spread across many chunks would perform repeated string concatenation with quadratic time complexity.

This change gives `LineSplitter` the option of using a `StringBuffer` to collect multiple carry-over line parts.
The buffer is needed whenever a chunk does not contain a line break, and needs to be combined with a previous chunk's carry-over. This avoids ever directly concatenating any more than two strings.
The `StringBuffer` is not allocated until it's first needed, so if lines are generally shorter than chunks, the buffer won't be used. Once allocated, the buffer is retained in case a buffer will be needed again, but cleared when its contents are used.

The code optimizes for the simple case of each chunk having a line break.

Fixes #51167

Bug: https://github.com/dart-lang/sdk/issues/51167
Change-Id: I600a011e02aa9f1ad6f88e45764df5b2e8eccfa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280100
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-02-21 11:33:24 +00:00
Ilya Yanok 029e0cec71 Revert "Enforce current library restrictions."
This reverts commit 0c05e33836.

Reason for revert: breaks ~10% of G3 smoke suite.

Original change's description:
> Enforce current library restrictions.
>
> Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
> Mark all current classes intended as mixins as `mixin class`.
>
> More additions and cleanup will follow,
> but this change should make everything keep working as today
> if we flip the switch.
>
> TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.
>
> Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Kallen Tu <kallentu@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ib0cb5b7ec1a8c392bbf9bf4af8dc3efc0b27991d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284187
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-20 15:29:41 +00:00
Daco Harkes 14e4a52657 [vm] Fix Dart_CObject_Type breaking change
https://dart-review.googlesource.com/c/sdk/+/257925 added a new entry
in the middle of the `Dart_CObject_Type` enum, which changed the
value of the entries below. However, this enum is part of
`dart_api_dl.h` and versioned by `dart_version.h`.

New entries to `Dart_CObject_Type` should be added at the end of the
enum to avoid making breaking changes to the type.

TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart

Bug: https://github.com/dart-lang/sdk/issues/51459

Change-Id: I367b54f62e59ddf925e255bb56c0f8660be7c227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284161
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-20 11:59:19 +00:00
Lasse R.H. Nielsen 0c05e33836 Enforce current library restrictions.
Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
Mark all current classes intended as mixins as `mixin class`.

More additions and cleanup will follow,
but this change should make everything keep working as today
if we flip the switch.

TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.

Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-02-18 12:37:40 +00:00
Lasse R.H. Nielsen 61a4fb4f9e Update Future.onError extension method.
Now works better with futures that have been up-cast.

CoreLibraryReviewExempt: Rewrite of existing pure Dart function.
Change-Id: Iefd05b9cfd8ff0cc3e27fc1122a670030e0901ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283680
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-02-18 12:01:45 +00:00
Konstantin Shcheglov 3f288db57e Issue 51046. Implement primitive equality.
Bug: https://github.com/dart-lang/sdk/issues/51046
Change-Id: I2190b9e36753cc5f4708597ae0b515430d2f7bf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-18 06:22:04 +00:00
Kallen Tu f385641fd4 [cfe] Disallow classes to be used as mixins even inside the library.
Change-Id: I388a4fabb4ba6267c2ed6f276ef796d9c90dc14d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283130
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-17 20:41:39 +00:00
Alexander Thomas 9ec898a83f [test] Skip html/interactive_geolocation_test on all OSs
The test either times out or fails on all operating systems.

Change-Id: Ibef092bf808f6562a2eb571cd41cc555fd889dbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283863
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-02-17 19:35:32 +00:00
Joshua Litt 71cffed55c [js_types] Add Helpers to work with JSUndefined and JSNull.
Before we can reify `JSUndefined` and `JSNull` we need to give users a way to detect these values. Once existing users have migrated to these new helpers, then we can start boxing `JSUndefined` and `JSNull` on Dart2Wasm.

There are a few steps here:
1) Land these helpers, but for now they will just preserve the existing semantics.
2) Deploy JS types to Flutter and `package:test`, i.e. everywhere Dart2Wasm's JS interop is currently being used, and use these helpers instead of `null` checks.
3) Switch the semantics of the helpers to stop conflating on all Web backends, while simultaneously boxing `JSNull` and `JSUndefined` on Dart2Wasm.

CoreLibraryReviewExempt: Refactoring web only libraries + some changes to Wasm's internal libraries.
Change-Id: Idb50b28b3087438751557ffd28505c7b536bf78b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282481
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-17 18:20:59 +00:00
Kallen Tu 3118002665 Revert "[analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed."
This reverts commit f17e9732c5.

Reason for revert: Merged this and forgot there were dependencies that needed to be merged first.

Original change's description:
> [analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed.
>
> Change-Id: Ia1393851dffaab55c31d04d4e81bfae83a7bd67f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283126
> Commit-Queue: Kallen Tu <kallentu@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

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

Change-Id: Ia339aac26ecd20aa8725cc9109919e3cbef6363b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283741
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-02-16 22:10:33 +00:00
Kallen Tu f17e9732c5 [analyzer/cfe] Report an error when declaring a mixin class with final, interface, or sealed.
Change-Id: Ia1393851dffaab55c31d04d4e81bfae83a7bd67f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283126
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-16 21:27:28 +00:00
Daco Harkes dc45e67c5e Reland "[vm/ffi] Disallow nullable struct fields"
This is a reland of commit 4e7d71b593

Flutter's dependencies have been rolled.
g3 has also been rolled.

TEST=tests/ffi/regress_51041_test.dart

Original change's description:
> [vm/ffi] Disallow nullable struct fields
>
> TEST=tests/ffi/regress_51041_test.dart
>
> Closes: https://github.com/dart-lang/sdk/issues/51041
> Change-Id: I44d82c5f378c5d001bfb7526be87c179b8160be1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279511
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: I66580ad7c2f032c17cc708ce875e8dba942ae44b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283600
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-16 11:26:38 +00:00
Johnni Winther ac20881b23 [_fe_analyzer_shared] Handle record types in exhaustiveness checking
This adds support for record types in the exhaustiveness algorithm.

The original algorithm was based on that record pattern would
match fields on all types, but that is no longer the case. Instead
record patterns only match corresponding to their own type. For this
reason the testing code is updated to create record spaces in relation
to a type. For instance, when the test create a record space {x: B}, it
is know create in relation to a type, say (x: A, y: A), and the create
space will therefore have (x: *, y: *) structure where the y: component
is implicitly Top, similar to how object patterns are used.

Unlike the Dart record types used for type checking and inference, the
record types used for exhaustiveness do not take the field types into
account for its subtype relation. This is avoid conclusions like
(int i, Object o) and (Object o, int i) having no values in common because
their corresponding types (int, Object) and (Object, int) are not subtypes
of each other. Instead, the subtype relation for record types used for
exhaustiveness only use the structure of the record to determine whether
two types are related.

Note though, that fields of a record type still know the type of the field.
This is used when expanded a record type into a space; the field spaces
will be derived from the field types in this case.

Change-Id: I84735d827494bcf384fd5f419d71933830ff5d15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283182
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-16 00:36:01 +00:00
Joshua Litt c9155cc612 [js_types] Add JSPromise and JSVoid.
CoreLibraryReviewExempt: Changes to Web specific libraries.
Change-Id: I71cc720dcf1cea3ca8a219259ccd35912ed00d9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282940
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-15 17:03:28 +00:00
Kallen Tu 50e1400d97 [tests] Fix tests to report an error when classes are used as a mixin, even in the same library.
Change-Id: Icdb4c4e87bf3143ea9c37272f27e7eac0c7613a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283129
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-15 15:26:49 +00:00
Johnni Winther 0937087af8 [parser] Improve error recovery for constant patterns
This allows the parser to parse constant patterns at lower precedence
level in order to recognize more expressions in this context. To
support this, _parsePrecedenceExpressionLoop special cases a few cases
that should _not_ be parsed as expression in a constant pattern context.

Closes #50996

Change-Id: I43bb0ce52d366bd2dfcf47e12eec5883402f668a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282100
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-02-15 13:49:37 +00:00
Daco Harkes 7a18d3c6c5 [test/ffi] @Native assets test AOT with --strip
This more closely resembles --release compilation in Flutter on Linux
and Android.

TEST=tests/ffi/native_assets/asset_absolute_test.dart

Bug: https://github.com/dart-lang/sdk/issues/49803
Change-Id: I51ea100966393cd25b11a44dc2c40ce43552ae87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283184
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-02-15 13:21:36 +00:00
Johnni Winther d4a73e3b82 [cfe] Report errors on invalid const patterns with explicit 'const'.
Change-Id: I4f5994fd1f0d5e5289684e0da2f03720706f6d28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-15 10:34:28 +00:00
Aske Simon Christensen 7a63ff2604 [dart2wasm] Fix reversal of break labels crossing finally.
The block starts and ends for the entry points to the finally block
instances corresponding to break paths were emitted in the same order,
causing the jump targets to be reversed.

Change-Id: Ifc8a6b6320ba7341140606c98333f5825d2228ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283042
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-02-15 10:24:08 +00:00
Nicholas Shahan b9699971dc [test_runner] Unify name for passing DDC options
Use "ddcOptions" in test files to closer resemble the name 'ddc-options'
from the test matrix or command line option.

I don't like that this option is in camelCase when written in a test
file but uses a dash when passed on the command line but that matches 
all the other implementations (dart2jsOptions, sharedOptionn, etc). 
Hopefully it is the most discoverable or least surprising choice.

Change-Id: I8f0d53d50416b952c9ea74406c18bb9c700f98dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281820
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-02-14 20:13:57 +00:00
Ryan Macnak d8b9a59f57 [test] Add missing resource dependency to web_socket_error_test.
Change-Id: I04bf0a991bc01f663e96fc82c812bebdf30a8933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281304
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-14 19:22:14 +00:00
Joshua Litt ff43c6e1f0 [js] Add limited support for operators.
Change-Id: I40f8ea6666272a68afd867c095066de2c6416816
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282620
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-02-14 18:03:42 +00:00
Johnni Winther 2b28b97e7a [_fe_analyzer_shared] Add new exhaustiveness algorithm
This adds the new exhaustiveness algorithm and uses it instead of the
old algorithm. The old algorithm is left in, for now.

Change-Id: I180934f05525aed3d4d43cd8a00bcc6e50305347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282720
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-02-14 17:26:05 +00:00
Daco Harkes 6a90c21992 [vm/ffi] Fix MemoryCopyInstr on ia32
The MemoryCopyInstr destroys the value in src-TypedDataBase
location. It overwrites it by loading the data_ field.

This requires using a WritableRegister, rather than a Register.

This issue seems to have been already present before the recent
optimizations (the leaq instruction overwrites array_reg), but the
recent optimizations made it exercise this instruction in a loop where
it was assumed the src-position was not destroyed.

TEST=tests/ffi/regress_51315_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51315
Change-Id: If37c6c39de8fd0cba9b8a25a1f38f025a39123d9
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-eager-optimization-linux-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283021
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-14 13:20:43 +00:00
Brian Quinlan 11b39ee058 Fix unbalanced call to Dart_TypedDataAcquireData.
Tested: unit test
Change-Id: I63249c3af001e4f1a9b9622bf6179062023f8d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282824
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-02-14 01:44:17 +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
Mayank Patke 61b2ec77e1 [dart2js] Automatically set dart.web.assertions_enabled=true.
When (user) assertions are enabled in dart2js, we automatically update
the environment as if -Ddart.web.assertions_enabled=true were
passed. This allows dev-only code to be gated behind
`const bool.fromEnvironment('dart.web.assertions_enabled')` without
having to supply a redundant option manually.

Change-Id: I40d670b6fe87d5e27b2b8d50599261cca8a79a42
Bug: b/254543452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270301
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-02-14 01:35:05 +00:00
Nicholas Shahan 2d3c9f4346 [dart2js, ddc] Skip flaky tests
These tests are flipping between Fail, Pass, Flaky at a rate that
is avoiding flake detection. Skipping until we can address the
issues.

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

Change-Id: I9a6aa25bdc1573fe1af8783c7ddb389282695540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282810
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-02-13 23:44:59 +00:00
Brian Quinlan 11f7a52b94 [io] Faster readIntoSync for UInt8List.
Adds a specialized code path to File_ReadInto which avoids a memory copy when writing to a UInt8List.

Benchmarks:
https://docs.google.com/spreadsheets/d/1AqT5bDCaRfxalK9WLqGlm_EfVpTmeQT7LEqaJ-Hyl1c/edit?usp=sharing&resourcekey=0-NivVhxs0J1GM4BHXHK5gAQ

Tested: unit tests
Change-Id: I7d6cb5257da1724e8c61412b0f84bee22da298ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280560
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-02-13 21:23:01 +00:00
Joshua Litt 40cc0bd479 [dart2js] Ensure JavaScriptObject's interceptor is emitted.
Bug: #51307
Change-Id: I2aab631cabc659e882e4bf998bcf287c7dc76465
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281872
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-02-13 20:35:59 +00:00
Srujan Gaddam c50a40988a [dart:js_interop/pkg:js] Allow interop on typed_data, errors, and Array
Closes https://github.com/dart-lang/sdk/issues/50899

Allows users to interop with types that have been bound to @Native
types on the JS backends, error types that have been bound in DDC,
and the JS Array type.

Change-Id: Ic28a60127e558eb8bb017595ac54a43920a500c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282483
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-13 19:47:25 +00:00
Daco Harkes dc2c739a6c [vm/ffi] Fix Struct use in @Natives
The FfiNative transform was trying to access the generated struct
constructor which is added to the AST in the FFI definitions transform.

The FFI definitions transform has to run _before_ the FFI native
transform.

TEST=tests/ffi/regress_51321_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51321
Change-Id: I6b5caf6e5851455cece6aec13ef73d85cc201ebf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282103
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-13 09:40:24 +00:00
Srujan Gaddam 2fc8685a4d [dart:js_interop] Add support for external inline and extension instance members
External inline instance members can be lowered the same way as
external extension instance members on interop classes. Similarly,
code is refactored so that external extension members can exist
on inline interop classes and are lowered accordingly.

Change-Id: I341bfeef3f1b74b54a63c963553af9230c4a10c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280621
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-11 00:03:57 +00:00
Konstantin Shcheglov c6352b0e49 Unit tests for NON_EXHAUSTIVE_SWITCH and UNREACHABLE_SWITCH_CASE.
Change-Id: I0b291046eba881acd35aeba1f4725c84f0bc9bcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-10 21:50:27 +00:00
Joshua Litt 13b24aeedd [js_interop] Change conversion functions to be getters.
CoreLibraryReviewExempt: Internal refactoring of a not yet used library.
Change-Id: Iad62b0d4a7fc4df0c710f6ba0dd7c9b21b6a6fef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281868
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-02-10 20:08:53 +00:00
Joshua Litt 130903685d [dart2wasm] Avoid implicitly internalizing WasmExternRef.
CoreLibraryReviewExempt: Wasm only changes.
Change-Id: I0e0a6cddffa1c7f2d7c74779f480dd10bf509c1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279268
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-02-10 16:22:47 +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
Kallen Tu 36c6a5c9f8 [cfe] Report errors for non-trivial generative constructors in mixin classes.
Allow factory constructors.
Allow trivial const/non-const named/unnamed constructors.

Change-Id: I8ec33b58877acb95ce16de8f8bd2ad29b57795cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-09 23:58:21 +00:00
Nicholas Shahan 87d1806055 [test_runner] Add new name for ddc compiler
* The new compiler name "ddc" will be used for all configurations
  in an upcoming change.
* Aliases "dartdevc" and "dartdevk" will be removed in the future.

Change-Id: I2fa48e0ec043b1ba7fb70f883b39e40f338b6928
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280862
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-02-09 18:32:58 +00:00
Johnni Winther d89ae3c2c6 [parser] Report error on invalid const patterns
This handles the restriction imposed on the expression occurring
within a constant pattern.

Change-Id: I946d85f908609340a61e060c6bdbee143666fd91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-09 12:43:31 +00:00
Stephen Adams a0fce7be4d [dart2js] Dynamic calls to record getters.
Added synthetic getters for records that are attached to the shape class.

It is a bit clunky since there are assumptions that a method came from something defined in Kernel.

- There is no source information for the synthetic method
- There are assumptions that some information can be derived by reference to Kernel definitions.

We do get a lot for free doing it this way, e.g. tree-shaking of unused getters and call-through stubs of getters used as a dynamic method invocation.

Added a test that (1) uses names that require the interceptor calling convention and (2) requires dart2js to generate call-through stubs.

Issue: #49718

Change-Id: I682c1f005e87765b0e3bf7e6550c945d30b56b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280960
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-02-08 23:13:07 +00:00
Kallen Tu 7acd3ba380 [tests] Language tests for mixin classes allowing trivial generative constructors.
Change-Id: I332707692917f28b6f43f1ca41cb8b6c101464fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281521
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-08 21:12:20 +00:00
Ahmed Ashour d23c304a58 Fix year and comma in header.
Bug #51184

Change-Id: I0f93d6aefcf693fbddbefe4cf96bf275a6bf702b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280168
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-02-08 17:45:40 +00:00
Daco Harkes 732e4a43d5 Revert "[vm/ffi] Disallow nullable struct fields"
Revert submission 279511

Reason for revert: Flutter dependencies are using nullable struct
fields and need to be migrated first
https://github.com/flutter/flutter/issues/120260

Reverted changes: /q/submissionid:279510 /q/submissionid:279511

Change-Id: I7ab66ef6c6b5f21303804b2930af4ad6aa000413
Tested: Revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281600
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-08 08:51:28 +00:00
Daco Harkes c95d1fc1ad [test/ffi] Fix test
Closes: https://github.com/dart-lang/sdk/issues/51301
Change-Id: I1dba254b0e396003448ba24c1c676f3dde04a861
Cq-Include-Trybots: luci.dart.try:vm-asan-linux-release-x64-try,vm-aot-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281422
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-02-08 08:44:57 +00:00
Mayank Patke 397ed8673c [dart2js] Add phase 1 kernel transformer to simplify const conditionals.
Suppose we have code like

if (isDevMode) {
  // do foo
} else {
  // do bar
}

where isDevMode is const (or can be evaluated as const). In particular,
isDevMode can be controlled by compile-time options, like
bool.fromEnvironment.

We currently eliminate the dead branch during SSA, but that means we do
the work of compiling dead code in the previous phases. Instead, we can
recognize that the condition is const (or effectively const) and
eliminate the dead AST subtree directly.

Change-Id: Ia91da5ebc7fa496a1b963308c6e02d572cab936e
Bug: b/254543452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270281
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-02-07 20:07:57 +00:00
Srujan Gaddam ff01414b8f [dart:_js_interop] Add support for statically resolvable inline class interop members
Amends lowerings on dart2wasm and JS backends to work for external
constructors/factories and static members. Tests members with and
without renaming of members/classes/libraries. Note that this does
not add support for object literal factories yet.

Change-Id: I149bef7249c1a13a31eed9f3510256d407b1d3e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280056
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-07 18:47:23 +00:00
Paul Berry a242875197 Test legacy flow analysis behaviour of case null.
I will be soon be implementing flow analysis for constant patterns.
This test is to ensure that when the language version doesn't include
support for patterns, we reproduce the legacy behaviour of `case null`
(which is not to draw any conclusions about type promotion or
reachability).

Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: I2336a0e2cc30f5edf38d2b8da6bcd63fc62b30fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281282
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-02-07 17:10:10 +00:00
Kallen Tu 9c86cb80bb [tests] Update language tests with base/final subtyping loophole fixed and a few enum tests.
Change-Id: Id30bbdc4b6eedf0751f725024acbed812a07a4fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280860
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-02-07 03:01:27 +00:00
Daco Harkes c42d356199 [test/ffi] Skip self-invoking tests in appjit
Closes: https://github.com/dart-lang/sdk/issues/51265
Closes: https://github.com/dart-lang/sdk/issues/51266
Change-Id: If52adcce9b3d72fd6097e7d7c9f1f9aa1ffc3bc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281183
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-06 19:11:47 +00:00
Daco Harkes 4e7d71b593 [vm/ffi] Disallow nullable struct fields
TEST=tests/ffi/regress_51041_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51041
Change-Id: I44d82c5f378c5d001bfb7526be87c179b8160be1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279511
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-06 16:29:42 +00:00
Aske Simon Christensen 91fe18c4e3 [dart2wasm] Skip flaky lib/async/stream_periodic3_test
Issue: https://github.com/dart-lang/sdk/issues/50901

Change-Id: Idcfa9970eaeff39ed986085f453bb176fb986243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281100
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-02-06 12:22:28 +00:00
Chloe Stefantsova 5cff200999 [cfe] Don't join unused same-name variables in pattern switch cases
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I245a68f48a217e26ad2e1a74a8996a8fef128da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-02-06 10:24:35 +00:00
Nicholas Shahan d00acae4ae [ddc] Remove old dwds versions fallback support
The dart:developer APIs `registerExtension()` and `postEvent()` no
longer write directly to the console.

Fixes: https://github.com/dart-lang/sdk/issues/48103
Change-Id: I41ee807eb376abbac87d0f353dde22bebd732faa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279233
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-02-04 04:09:48 +00:00
Ryan Macnak 8236fad86a [test] Synchronize status entries for fragmentation_test.
Was marked in standalone_2 but not standalone.

Change-Id: I2c20c64f7d472d94642a3ada595c33412ef3bc3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280800
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-03 20:43:10 +00:00
Kallen Tu b7d0a982b6 [cfe] Report errors for final class and mixin subtyping outside of its library.
Change-Id: I958fd30e2ed37ae3ca4311967575c8176ca2cd48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280249
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-03 01:17:41 +00:00
Kallen Tu aa7a150bcd [cfe] Report an error when extending an interface class or mixing in an interface mixin.
Change-Id: I23019c69f74f2405f196eac5d58048138bc6408a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280244
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-02 23:23:13 +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
Aske Simon Christensen bc31fe4903 [dart2wasm] Enable values to be returned from void functions.
Since Dart `void` can actually carry values, functions with `void`
return type are translated into Wasm functions returning the Dart
object top type instead of an empty output type list.

Only constructors, setters and imports/exports with void return type
are now given empty output type lists in their Wasm signatures. A new
low-level `WasmVoid` type is added to the internal Wasm types for
specifying explicitly that a Wasm function should have an empty list
of outputs.

Fixes https://github.com/dart-lang/sdk/issues/50458

CoreLibraryReviewExempt: Only changes Wasm-specific libraries.
Change-Id: I9562248f94e75a60142fd1af0136183aa288b98b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279971
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-02-02 12:08:30 +00:00
Kallen Tu 8cce064bf1 [analyzer] Report errors for final class and mixin subtyping outside of its library.
Change-Id: I7fbd0d0e36d360ce1a02cf7c4ecd6ccd2a29c999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280206
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-02-01 22:11:39 +00:00
Kallen Tu 6ee64808ce [cfe] Refactor error handling for all existing class modifier behaviour.
Change-Id: I925f008ef3a1522c4e60f283dbdbd0fb5b1e290c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280049
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-01 20:08:50 +00:00
Johnni Winther 93ebb9a852 [cfe] Handle general types in object pattern
Closes #50872

Change-Id: If1a8225b85e70bedb1391d6ee8d6d34a70015553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280118
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-01 10:24:44 +00:00
Johnni Winther e77907f755 [test] Extract test for "native"
This move the test of the "native" syntax, support by the CFE, to
a separate test. The test (expecting the syntax to _not_ be supported)
fails on the CFE but that has nothing to with the records/patterns
features which the remaining tests in syntax_test.dart require.

Change-Id: Idef0d8b58b24488bcd4e3318eac9638152056b2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280111
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-01 10:06:37 +00:00
Stephen Adams 5164ecd5ec [dart2js] Add test for issue 51179
http://dartbug.com/51179 - the defaulted value of `s1` is `null` instead of the correct string `'default value'`.

Bug: 51179
Change-Id: I437d95d8a4a273fd014a005f6c40a9be05f45d2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280138
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-02-01 03:29:49 +00:00
Kallen Tu 95c1899b43 [analyzer] Report an error when extending an interface class or mixing in an interface mixin.
Change-Id: I868b8c89fa52edbcd05d7f06e3246196bbf3d952
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279910
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-31 19:18:40 +00:00
Brian Quinlan 252015b30b [io] Fix a bug where large reads would return partial data.
Bug: https://github.com/dart-lang/sdk/issues/51071
Change-Id: Ia64d803c9709b106e52a1c671c1c3288c051bd85
Tested: ci + new test
CoreLibraryReviewExempt: bug fix only for vm
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279204
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-31 18:41:39 +00:00
Aske Simon Christensen 5aae8f9688 [dart2wasm] Skip VM-specific co19 Finalizer tests
Change-Id: I6ba56c089362bf6c36a7f7cd918862d72cb68991
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280089
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-31 10:28:36 +00:00
Kallen Tu 83a9a0a3f4 [analyzer/cfe] Make sealed and mixin class errors more precise and synced between the CFE and analyzer.
Updated corresponding language tests. No new behaviour, updated test messages and location.

Change-Id: Ib3c7e2d701bdfbb68757c532b945348f6cbebad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280062
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-31 01:53:09 +00:00
Srujan Gaddam 821d85e661 [dart:_js_interop] Expose a interop type for JS objects
Moves JSObject to dart:_js_helper, so that JavaScript objects
can be used with that type in the JS backends. The type then
gets reexported in dart:_js_interop with a typedef.

This is purely for experimentation. This class needs to be sealed
before we can publish this library.

Change-Id: I16093165deaa5bc5d7940eb0cb98da32c36e485a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278894
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-30 20:01:37 +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
Aske Simon Christensen e805b776bc [dart2wasm] Use status files for defining which tests to run
This makes it easier to run tests locally, just specifying the suites
`co19 corelib language lib web` to `test.py`.

It also make it easier to change which tests we run going forward.

Change-Id: I3a4765c18ee105055fdb9a6b59036da11b956e1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279973
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-01-30 10:42:22 +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
Jackson Gardner 4dff36345e [dart2wasm] Use the asset in @Native annotations to specify the module name.
Change-Id: I5e3644a904917a375486acd47830f311fe19a5ce
Tested: Running unit tests in this repo as well as running against coming web engine changes that use the @Native annotation: https://github.com/flutter/engine/pull/39072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279479
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-28 00:03:07 +00:00
Srujan Gaddam 70f1858700 Filter trusttypes_test from being run on CSP bot
Change-Id: Ie241d1eabbcb28ef4e50661a2afda2d832317c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279909
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-27 03:13:07 +00:00
Kallen Tu f48a1fb3da [analyzer] Report error when implementing a base class.
Change-Id: Ia55354350451849a112a32bb048a4fcbe5afe1b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279655
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-26 22:15:57 +00:00
Srujan Gaddam 812d26f7b1 [pkg:js] Amend lowerings tests to use @JS on all top-levels and refactory trustTypes tests out
dart2wasm does not allow top-level externals to not be annotated
with @JS, even if the library is. trustTypes also is not supported
on dart2wasm.

Change-Id: I8c1d146dcf5d9f97559e854be690bb98726513b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279757
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-26 21:20:27 +00:00
Joshua Litt a64b34d3f3 [dart2wasm] Use static interop to implement regexp helpers.
This CL also adds changes how static interop objects are interpreted at the interop boundary. Previously, static interop objects were dartified / jsified like everything else. Now, they are simply boxed.

With this approach, users can now use `Object` when they want conversions and static interop objects when they don't(assuming these objects originate in JS, Dart objects are always fully converted).

Change-Id: I40b31bfb826e4963a34eaa373574c136e13b9009
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279451
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-26 17:03:40 +00:00
Kallen Tu 7cf49ba433 [cfe] Report error when implementing a base class.
Change-Id: Iff3c31b4883d3d4fc4c392c6ac8207617ce65761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279648
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-26 16:01:55 +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
Srujan Gaddam 45817fd9c7 [Reland][pkg:js] Lower @staticInterop non-anonymous constructors
This is a reland of https://dart-review.googlesource.com/c/sdk/+/279180.
This removes the anonymous constructor lowering, as the jsify
semantics are not the same as what we have today, since we do no
conversions today. This avoids the breakage in Flutter where we
convert a Uint8List in jsify.

Change-Id: I7eb4ffbd3258abdf6c1aea2035f7dab0336d4851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279231
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-01-25 18:50:27 +00:00
Josh Soref ef42a0b110 Spelling pkg analyzer lib
Closes https://github.com/dart-lang/sdk/pull/50860

GitOrigin-RevId: b27066c37f93c8c6d1123d6ebd6a4c0afcf59844
Change-Id: I15fa4aea1dad45daf168e34d1c4450320ec9b40a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277742
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-25 14:08:27 +00:00
Daco Harkes 90668fba0c [tests/ffi] Folder deletion on Windows
On windows we do have a crashpad handler we use to capture coredumps.
This functionality is initialized in `runtime/bin/main_impl.cc` /
`runtime/bin/crashpad.cc`. That may start a subprocess. If that
subprocess has the tempdir as working directory (or inherit handles
referring to it / subdirs/subfiles) it may prevent it from being
deleted.
Adding '--suppress-core-dump' to the Dart process invocations prevents
this.

TEST=ffi/native_assets/infer_native_assets_yaml_dart_kernel_snapshot
TEST=ffi/native_assets/infer_native_assets_yaml_process_run

Closes: https://github.com/dart-lang/sdk/issues/51067

Change-Id: I75807e65e9911653983158a238194968aaedb51f
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279399
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-24 16:15:21 +00:00
Johnni Winther 3184f2224b [_fe_analyzer_shared][cfe][analyzer] Initial implementation of exhaustiveness checking
This adds the initial implementation of exhaustiveness checking in
the analyzer and CFE. The checking is currently only performed in
switch statements and only handle a subset of the patterns.

Change-Id: Ia0050c2c80fbefe3e22615599136f9d919ebe4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279173
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-01-24 13:34:46 +00:00
Erik Ernst 4f8af109af Correct primitive equality error test
Implicitly induced noSuchMethod forwarders cannot eliminate primitive

equality: They are not generated at all if they would override an
explicit member declaration (here: `Object.hashCode` and `Object.[]`).
Hence, the classes `Secret...` that we used to have (which were intended
to do just that) were simply compile-time errors, and hence those
classes and the locations where they were used are being removed in
this CL.
Change-Id: Id1a1f9bc1a2f7ce1886388d6938d0d0a4da45d84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279394
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2023-01-23 22:24:35 +00:00
Josh Soref b3df0a4bd5 Spelling tests standalone
Closes https://github.com/dart-lang/sdk/pull/50863

GitOrigin-RevId: e514be37c7f3b48cbce1048c359df00be7d2b18a
Change-Id: I45ad308db60a5935f18a877f5480874acfef0efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277780
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 12:55:22 +00:00
Josh Soref ba15a61271 Spelling build
Closes https://github.com/dart-lang/sdk/pull/50859

GitOrigin-RevId: 7b056018c2925745701bdecdd7da325d9458204d
Change-Id: Iff037d773713bf73efde6951599becfd7297b921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277740
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 08:56:14 +00:00
Alexander Markov 573625c5bc [tests] Swap Expect.equals arguments in language/records/simple/runtime_type_test
Addresses comment https://dart-review.googlesource.com/c/sdk/+/259621/comment/ecb5a789_1efbef0d/

Change-Id: I6825827d034d3f247511084636876af2e3a67361
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279442
Reviewed-by: Stephen Adams <sra@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-01-20 19:24:09 +00:00
Daco Harkes 17f4198cfe [vm/ffi] Native assets Windows fixes
Some artifacts are .exe instead of .bat.

Library uris with file schemes use the Uri.path (using forward slashes
on Windows), so the tests emitting native asset mappings should use
Uri.path as well. (Not Uri.toFilePath() which uses backwards slashes.)
The paths of the dynamic libraries in the assets should use the
toFilePath(), as these are passed to the system API which expects
correct paths.

The Platform.script Uri has a path with file:///C: and back slashes.
The uri RFC does not support back slashes, and our ResolveUri does
neither. So for Windows we replace backslashes with forward slashes.

TEST=tests/ffi/native_assets/

Bug: https://github.com/dart-lang/sdk/issues/51066
Bug: https://github.com/dart-lang/sdk/issues/51067
Change-Id: I2e168e0549fe80d9a5366d636c6f1ef971942130
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-win-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-msvc-windows-try,dart-sdk-win-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279356
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-01-20 18:20:17 +00:00
Daco Harkes c087340a8a [gardening] Skip asset tests on RISC-V QEMU bot
The test tries to invoke itself with the Dart executable.
On QEMU, this is hard to find. (It would make more sense to compute
things on the host OS rather than doing self-invokes for QEMU, but
requires a significant refactoring of these tests.)

Test is already skipped on ARM QEMU.

Bug: https://github.com/dart-lang/sdk/issues/51067
Change-Id: I65d47141728223b835ac79d99c243baddb7ddcb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279346
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-01-20 14:24:52 +00:00
Alexander Thomas b9b6511ca6 Spelling sdk
Closes https://github.com/dart-lang/sdk/pull/50918

Co-authored-by: Josh Soref <jsoref@gmail.com>
GitOrigin-RevId: 1fd275051c561b63d374fb47e76a22424c4a12a9
Change-Id: I97790d9c79ff659f2c1fa2d2d46d041fe67957cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278530
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-01-20 12:37:49 +00:00
Daco Harkes 6ef57b86c1 [vm/ffi] Support varargs
This CL introduces `VarArgs` to `NativeFunction` signatures. The
`VarArgs` type takes a single type argument. This type argument is a
subtype of `NativeType` if there is a single variadic argument, and a
record with native types if there are multiple variadic arguments.
For example:
`NativeFunction<Void Function(Pointer<Char>, VarArgs<(Int32,Int32)>)>`
for calling refering to a `printf` binding with two `int32_t` arguments
passed as variadic arguments.

The logic of the native calling conventions are detailed in
https://dart-review.googlesource.com/c/sdk/+/278342.
Here we explain how this influences the FFI pipeline.

First, now that `VarArgs` is part of signatures, we have to unwrap
that when with the C types in the CFE transform and checking (analyzer
is in a separate CL), and also in the marshaller when looking up the
C type of arguments.

Second, we have to deal with `BothNativeLocations`. On windows x64,
floating point arguments must be passed both in FPU _and_ CPU
registers. For FFI calls, we solve this in the argument moves by just
copying to both locations. For FFI callbacks, we just take the FPU
register location (which avoids an extra bitcast).

Third, on System-V, we have to pass an upper bound of the number of
XMM registers used in AL. This means we instead RAX, we use R13 for the
target address. For variadic calls, we always pass 8 in AL as the valid
upper bound. We could consider passing the actual number of XMM
registers used.
We keep using RAX as default register for the function address on non-
variadic calls, because changing to R13 (the first free) register
creates more spilling in leaf calls. R13 is callee-saved while RAX is
not, so using R13 instead of RAX causes us to have to spill the value
from RAX on leaf calls.

Fourth, on both x64 and RISC-V, we pass floats in integer locations.
`EmitNativeMove` has been modified to deal with this, so that we do not
have to insert more `BitCastInstr`s.

The tests are generated by a test generator: `tests/ffi/generator/`.

The formatter doesn't support records yet, so the tests are not properly
formatted.
Bug: https://github.com/dart-lang/sdk/issues/50798

TEST=tests/ffi/*_varargs_*

Closes: https://github.com/dart-lang/sdk/issues/38578
Closes: https://github.com/dart-lang/sdk/issues/49460
Closes: https://github.com/dart-lang/sdk/issues/50858

Change-Id: I6a6296fe972527f8a54ac75a630131769e3cc540
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-debug-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276921
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-20 10:30:41 +00:00
Konstantin Shcheglov 8a28d75184 Update language/patterns/shared_case_variable_test
Change-Id: I5a6caeda972a588e39ff50b525d0f84f34c54c34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279321
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-01-19 21:10:09 +00:00
Josh Soref 84e3c8b50f Spelling tests
Closes https://github.com/dart-lang/sdk/pull/50920

GitOrigin-RevId: fa87531bd0f52b69485c9d02ff9e44a4a29c6a91
Change-Id: I0ae8574a5b77087895e004079f221201bb550cf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278535
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-19 16:24:29 +00:00
Kallen Tu ca974e5c4f [analyzer/cfe] Reland: Parse final class modifier.
Reland same files as https://dart-review.googlesource.com/c/sdk/+/278090
The only major change is parser_impl.dart parsing changes for 'final'

This change should allow 'final' for classes and mixins and maintain prior final behaviour for other constructs such as enums, typedefs, or the breaking line which was 'final library = ...;'

Change-Id: I3d84fc47479f39df6d5b0dcbe8f92d1fb78a826a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279076
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-19 16:08:28 +00:00
Erik Ernst 3b74c305fd Update syntax_test to avoid expecting new syntax to be a syntax error
New language features made `futureOr(null) = 1` a syntactically
correct pattern assignment, so it should not be expected to cause a
syntax error. This CL changes that test case such that it is still an
assignment to a syntactically correct function invocation, but not a
correct pattern assignment (so it's again a syntax error).

Added more tests with similar properties: The 3.0 grammar causes some
test cases to be wrong, and this CL makes changes such that they will
continue to test "the same thing" as far as possible in the new
language.

Change-Id: Ie0166f1a599ffeebfd352f4fadc01abc0950bd0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279169
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2023-01-19 14:44:36 +00:00
Joshua Litt abae306239 [dart2wasm] Add more test coverage for int in static interop APIs.
Change-Id: I6f77eeefb14e557be65c09a56ed814ab1702fac2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278804
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-19 04:46:47 +00:00
Riley Porter 329cb2088a [js_util] Add unsignedRightSift operator to js_util
Change-Id: Ibbf10bc5428e01e9f2bca24cf99489b186c7ba9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278995
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-01-19 03:16:33 +00:00
Alexander Markov b4764ced52 [tests] Fix lib/mirrors/reflected_type_generics_test/01
This test case incorrectly assumed that type literal
'Predicate' is a generic type, where

  typedef bool Predicate<T>(T arg);

However, it is instantiated to bounds and it is actually

  bool Function(dynamic)

Fixes https://github.com/dart-lang/sdk/issues/51052

Change-Id: I793aa505ff2b910d646d7374a3d6fc917ed6794c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279271
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2023-01-18 22:35:38 +00:00
Srujan Gaddam f93b5482af [pkg:js] Transform childen in export creator
We should visit the children of StaticInvocations, as they may
contain calls to createDartExport.

Change-Id: Ib2d91a60c48f3d2ddb5c6ef385114ea343d591ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279071
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2023-01-18 21:34:35 +00:00
Daco Harkes d2ef97258c [vm/ffi] Replace FfiNative with Native
See API design discussion in bugs below.

TEST=tests/ffi/native_assets/*

Design doc: http://go/dart-native-assets

Bug: https://github.com/dart-lang/sdk/issues/49803
Bug: https://github.com/dart-lang/sdk/issues/50097

Change-Id: Id6e6eb94c6eb39ccaaa637448583a40ab6110d12
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265084
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-01-18 21:08:38 +00:00
Daco Harkes 9a8508ebff [vm/ffi] FfiNative assets
Adds support for `asset: 'asset-id'` in `FfiNative`s.
Symbols in assets are resolved by
1. the provided [asset] (the bulk of this CL),
2. the native resolver set with `Dart_SetFfiNativeResolver` in
   `dart_api.h` (old behavior), and
3. the current process.

Symbols in assets are resolved by the Dart VM through the mapping
provided in the `vm:ffi:native_assets` library:
```
@pragma('vm:ffi:native-assets', {
  "linux_x64": {
    "<asset1>": [
      "absolute",
      "<absolute-path>"
    ],
    "<asset2>": [
      "relative",
      "<relative-path>"
    ],
    "<asset3>": [
      "system",
      "<system-path>"
    ],
    "<asset4>": [
      "process",
    ],
    "<asset5>": [
      "executable",
    ],
  }
})
library;
```

There are 5 asset path types. Symbols resolved in these asset types are
resolved as follows.
A. Absolute paths are dlopened, after which the symbol is looked up.
B. Relative paths are resolved relative to `Platform.script.uri`, and
   dlopened, after which the symbol is looked up.
C. System paths are treated as absolute paths. (But we might explicitly
   try to use `PATH` in the future.)
D. Symbols looked up in Process assets are looked up in the current
   process.
E. Symbols looked up in Executable assets are looked up in the current
   executable.

The native assets mapping can be provided in three ways.

X. In the invocation to `gen_kernel` with the `--native-assets`
   argument. This uses the gen_kernel entry point for compiling
   kernel.
Y. By placing a `native_assets.yaml` next to the
   `package_config.json` used by the isolate group. This works for
   `dart <source file>` and `Isolate.spawnUri(<dart source file>)`.
   This uses the kernel_service entry point for compiling kernel.
Z. By sending a String containing the native assets mapping when
   invoking the kernel_service directly from within the VM. Currently,
   only used for unit tests.

TEST=tests/ffi/native_assets/asset_*_test.dart (X)
TEST=tests/ffi/native_assets/infer_native_assets_yaml_*.dart (Y)
TEST=runtime/vm/ffi/native_assets_test.cc (Z)

The library is synthesized from yaml in pkg:vm as AST.

Design doc: go/dart-native-assets

Bug: https://github.com/dart-lang/sdk/issues/49803
Change-Id: I8bf7000bfcc03b362948efd3baf168838948e6b9
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264842
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-18 21:08:38 +00:00
Ahmed Ashour 49c7d93042 [cfe/analyzer] add CompileTimeErrorCode.CONTINUE_LABEL_INVALID
Fixes #49852

Change-Id: Ic4d475d383dba51ad438de5ef7f928ce5d105e12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277481
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-01-18 19:10:46 +00:00
Erik Ernst af51dc4249 Add tests about primitive equality
Change-Id: Ife971f04010e801f58be48c578d6df11103fb29d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279165
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-01-18 18:34:30 +00:00
Kallen Tu 73bdcabc9f [cfe] Report error when mixin classes have a generative constructor.
Change-Id: I89dd5dd54b7d309563e639362dc8cfe204caec11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279060
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-18 15:28:42 +00:00
Kallen Tu ef147e4c68 [cfe] Report error when mixin classes have a non-Object superclass.
Mixin class modifier cannot be applied to classes whose superclass is
not 'Object'.
Spec for reference: https://github.com/dart-lang/language/blob/master/accepted/future-releases/class-modifiers/feature-specification.md#static-semantics

Change-Id: Ib84ea86d257d2b0a9345d5f91e81b48f599cd2b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278812
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-18 03:42:08 +00:00
Kallen Tu 0f4bf12856 [analyzer] Report error when mixin classes have a constructor or a non-Object superclass.
Mixin class modifier cannot be applied to classes whose superclass is
not 'Object' or declares a constructor.
Spec for reference: https://github.com/dart-lang/language/blob/master/accepted/future-releases/class-modifiers/feature-specification.md#static-semantics

Change-Id: I4495d2d2b2ca7c39a86568ffad2de0189cc99f39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278809
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-01-18 00:35:58 +00:00
Kallen Tu e72126c8c7 [tests] Tests for the mixin class modifier.
Change-Id: Ice3f7e9c7198d22833b03eb45b6151e91700c8e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278095
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-17 22:29:46 +00:00
Johnni Winther 21cc667dca [Reland][cfe] Support external constructor with final fields
This adds support for having a final field and an external constructor
without error, assuming that the external constructor initializes the
final field. This supports the inline class with external members use
case.

Change-Id: I33b78275e967636ed0697d17f7921e9eee30401b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279095
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-01-17 17:29:28 +00:00
Srujan Gaddam 75f2db6337 Revert "[pkg:js] Lower @staticInterop external anonymous and non-anonymous constructors"
This reverts commit 9c8051b3ee.

Reason for revert: b/265769171, broke a number of google3 targets

Original change's description:
> [pkg:js] Lower @staticInterop external anonymous and non-anonymous constructors
>
> Lowers external factories on non-anonymous classes to a callConstructor
> invocation and lowers external anonymous factory invocations to a jsify
> call taking in only the arguments that were passed. In a future CL,
> tear-offs of external anonymous factories will be disallowed.
>
> Change-Id: I288230f24435fac8a15079f54bddce1c2c1a6521
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277049
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

TBR=sigmund@google.com,srujzs@google.com,rileyporter@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ice0718b169aa1cdc3bc1d1ad5bcab1d6a88e3149
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279180
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-01-17 17:29:07 +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 0673894cd9 [pkg:js] Disallow @staticInterop synthetic and @anonymous constructor tear-offs
Generative synthetic constructors of @staticInterop classes are already
disallowed, but this adds errors for tear-offs of such members as well.
This also disallows tear-offs of @anonymous @staticInterop factory
tear-offs. This aligns with what we want to do with object literal
constructors going forward, as tear-offs will implicitly have different
semantics than direct invocations. To avoid that inconsistency, we
disallow tear-offs here.

Change-Id: Ifc9e4a9251743613ee1ea2eca6e42e36c3b20461
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278645
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-16 22:31:33 +00:00
Srujan Gaddam f04331891f Update CFE expectations and fix top-level external members
Since we lower @staticInterop members differently, CFE expectations are
updated. A previous patchset updated tests to account for changes in
top-level external members, but those changes are now non-breaking.
This CL still keeps some of those fixes to tests since they are more
sound and correct:

- Debugger tests to allowInterop a function that wasn't caught before,
as DDC only adds checks for arguments whose static type is a Function,
whereas js_util does a runtime is check to determine if the argument is
a Function
- Interop tests that typed top-level externals unsoundly
- Interop tests that used tear-offs of top-level external methods
instead of getters

Change-Id: I46a5a1316db1dba38691efece075f9c34ac4b4e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277660
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-16 22:31:33 +00:00
Srujan Gaddam 9c8051b3ee [pkg:js] Lower @staticInterop external anonymous and non-anonymous constructors
Lowers external factories on non-anonymous classes to a callConstructor
invocation and lowers external anonymous factory invocations to a jsify
call taking in only the arguments that were passed. In a future CL,
tear-offs of external anonymous factories will be disallowed.

Change-Id: I288230f24435fac8a15079f54bddce1c2c1a6521
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277049
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
Srujan Gaddam 1e06e37e18 [pkg:js] Lower external static @staticInterop class members
Lowers external static class members (fields, getters, setters, methods)
on a @staticInterop class to their respective js_util transformations.
Tests are added for a non-namespaced and a namespaced library.

Change-Id: Ife0b53c05310e924ebfbcf2059f6048ae8447c2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277047
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-16 22:31:33 +00:00
Brian Quinlan 3571b97b24 [win/io] Fix a bug where RawDataSocket would send truncated data on Windows.
Bug:https://github.com/dart-lang/sdk/issues/31873
Change-Id: I8856bad941330f24671fc2c61af736fc54cd9459
Tested: unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278981
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-13 20:36:55 +00:00
Joshua Litt f9cd2e2158 [dart2wasm] Specialize JS methods based on receiver.
Change-Id: I48f1841e51ef8b67802909254d4a30b83c700e52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273010
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-01-13 14:41:09 +00:00
Sam Rawlins b9a42c82bc Move seven more Hints to be StaticWarnings:
* ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER
* BODY_MIGHT_COMPLETE_NORMALLY_CATCH_ERROR
* BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE
* DEPRECATED_EXTENDS_FUNCTION
* DEPRECATED_IMPLEMENTS_FUNCTION
* DEPRECATED_MIXIN_FUNCTION
* DEPRECATED_NEW_IN_COMMENT_REFERENCE

This requires allowing these warnings to be reported in language tests without being expected.

Also, observatory now must comply with BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE (or we could ignore the diagnostic).

TESTED=unit tests

Change-Id: I8facfa48a8645bac5bf8037163076a8f0a0ad05e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275740
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-01-12 19:17:35 +00:00
Aske Simon Christensen b8f0fda3dd [dart2wasm] Switch to the new WasmGC test/cast instructions
Also implements various related changes to the WasmGC spec:
- Remove `dataref` and add `structref` and `arrayref`.
- Use new encoding for `array.len` without immediate.

Change-Id: Ic1ba67fad694c453fbdae277f5a7e4c94695977f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266200
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-01-12 14:08:56 +00:00
Konstantin Shcheglov 473b5f80b1 Fixes for language/patterns/ tests.
Change-Id: I3c7babafd5d9ee9d41069c6e7d04e813709b1a70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278884
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-01-11 20:49:28 +00:00
Konstantin Shcheglov 12e812c45d Report PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
Change-Id: I46c7dbf8213a6b35593135e0930f9ad1051eef63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278815
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-01-11 15:35:42 +00:00
Joshua Litt 20a07e8073 [dart2wasm] 'Fix' hashCode for JSValue.
Change-Id: I2b071a24be8b2254ed2a696f901a5aacb034a4b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278813
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-01-11 02:27:43 +00:00
Kevin Moore 12355a5be2 test: fix testZLibDeflateInvalidLevel
Change-Id: I9e8a28a3f9994836bd026d90a49aed7371665092
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270285
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-01-10 22:34:31 +00:00
Brian Quinlan b0009cd7a4 Fix http_requested_uri_test to not require a timeout.
Change-Id: I4886df99a529ced3cdba5c36acc348fb4081ddea
BUG: https://github.com/dart-lang/sdk/issues/50974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278802
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-10 20:54:19 +00:00
Brian Quinlan 266c90346c [io] Fix a where HttpClient was not correctly tracking pending
connections when an error occurs.

Bug:https://github.com/dart-lang/sdk/issues/50054
Change-Id: I940236a259f8826b790d9189789287981350659a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278644
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-10 20:01:29 +00:00
Johnni Winther deaf9ce16e Revert "[cfe] Support external constructor with final fields"
This reverts commit c70d266270.

Reason for revert: Crash detected

Original change's description:
> [cfe] Support external constructor with final fields
>
> This adds support for having a final field and an external constructor
> without error, assuming that the external constructor initializes the
> final field. This supports the inline class with external members use
> case.
>
> Change-Id: Ie297ccc39b0a0731c146f9ac0698bba3fd83bfeb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278502
> Reviewed-by: Srujan Gaddam <srujzs@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I339d9008cb84cda8dc20f29d1e103289bb5596b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-01-10 17:20:01 +00:00
Ömer Sinan Ağacan 8db3be7557 [dart2wasm] Fix invocation forwarder named argument adjustment
Invocation forwarders currently cannot distinguish a named parameter not
passed from passed as `null`.

Refactor `getNamedParameter` to return nullable index. When the index is
not null it means that the named parameter is present, and its value may
be `null`.

This doesn't fix any of the existing tests so I added a regression test.

(Bug originally discovered and fixed in
https://dart-review.googlesource.com/c/sdk/+/278505)

Change-Id: I960c674073b3d25c37e79f9836647882acaff08b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278745
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-10 13:37:33 +00:00
Alexander Markov 88400bdc42 [vm] Update number of parent function type arguments
Number of parent type arguments in function types is critical
for instantiation and subtype checks when there are nested
generic function types. So it is important to update
number of parent type arguments when parent function type is updated.

This change adds mechanism for updating number of parent
type arguments and uses the new mechanism in 2 cases:

1) When a type parameter is substituted during type instantiation.
   The substituted type can have nested generic function types and
   it should be updated if substituted inside another generic
   function type.

2) When creating a constructor tear-off for a generic class.
   Parameter types of the constructor could have nested generic
   function types and they should be updated as tear-off itself is a
   generic function.

TEST=language/function_subtype/generic_function_type_substitution_test
TEST=language/regress/regress50905_test

Fixes https://github.com/dart-lang/sdk/issues/50614
Fixes https://github.com/dart-lang/sdk/issues/50905

Change-Id: If13baa420939f5ac002ce32f3909953fb6998bd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278525
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-01-10 03:10:14 +00:00
Kallen Tu 7fa8694c45 [tests] Language tests for 'final' class modifier.
Change-Id: Ia39b96db7470fd9d7bb5f6683262d78a1a08ada7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276769
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-10 01:05:14 +00:00
Kallen Tu f3c774c67f [tests] Language tests for 'interface' class modifier.
Change-Id: Ia80f64e61aea46ba1f5fa5223c399f03c458fbec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276840
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-10 00:30:15 +00:00
Kallen Tu 1e39261b4a [tests] Language tests for 'base' class modifier.
Change-Id: I2b5cf3d2d367d0cfd2d2da60268b36f16225ab1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276762
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-09 22:29:14 +00:00
Brian Quinlan f502427120 [io] Fix a bug with HttpRequest.requestedUri with absolute urls
Bug:https://github.com/dart-lang/sdk/issues/50704
Change-Id: I1139f3ab720960d4d2e4d350f0b00f6afd2ed2cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278481
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-01-09 22:11:29 +00:00
Kallen Tu 30b9b20965 [analyzer] Report error if class mixed in outside of its library unless it's a mixin class.
Classes can't be implicitly used as mixins outside of its library unless its in a language version prior to sealed classes.

See: https://github.com/dart-lang/language/blob/master/working/base-interface-final/feature-specification.md#mixin-classes
Change-Id: I77762a1c962e10f89430e2b4c6141d00ace1cb30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-01-09 20:22:14 +00:00
Josh Soref 46ee7eb873 Spelling samples
Closes https://github.com/dart-lang/sdk/pull/50919

TEST=ci

GitOrigin-RevId: 5ac389ee109d6a06f89d405da916945c36e1d24d
Change-Id: Ica078a14e87234459c0703c41c8bae5157132b14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278532
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-01-09 17:44:29 +00:00
Josh Soref aee77b9a33 Spelling tools
Closes https://github.com/dart-lang/sdk/pull/50880

TEST=ci

GitOrigin-RevId: ea8ecf4b7b921de0549df325be1a1f7879e86b72
Change-Id: I39315609a8390b012196a08c9ce4a9a6a50b1558
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278061
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2023-01-09 15:48:57 +00:00
Johnni Winther c70d266270 [cfe] Support external constructor with final fields
This adds support for having a final field and an external constructor
without error, assuming that the external constructor initializes the
final field. This supports the inline class with external members use
case.

Change-Id: Ie297ccc39b0a0731c146f9ac0698bba3fd83bfeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278502
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-01-06 12:25:21 +00:00
Josh Soref 50b94ef9fc Spelling runtime bin
TEST=build VM

Closes: https://github.com/dart-lang/sdk/pull/50862

GitOrigin-RevId: ae54b37666f70f670ee3af11c984c7e9a7e9da26
Change-Id: I459fda0439a1cd368f488a70d84ee6bb915e60bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277761
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-06 07:48:22 +00:00
Josh Soref 1ab011a2a7 Spelling tests web
Closes https://github.com/dart-lang/sdk/pull/50879

TEST=only changes to spelling to comments and internal string messages
GitOrigin-RevId: 3fa4104fa17054ea2247118a1b6213c62f2749e0
Change-Id: I776120bb2492c662dd32612dd2f6a670b5891e42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278060
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-05 01:26:52 +00:00
Jackson Gardner 4970f7fa82 [dart2wasm] Emit code for assert initializers.
Change-Id: I0eb69de0027e51c7b821c2da045fe91d65ab4dc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278091
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2023-01-05 00:23:40 +00:00
Kallen Tu 2083db9cdb [cfe] Emit error for mixing in class outside of its library except mixin classes.
It is an error to mix in a class declaration that does not have the 'mixin' modifier, outside of its library for class declarations in a library version lower than sealed class' release version.

Change-Id: I318bb243705748eae60482b6c3513669f1cbb90c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275440
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-29 21:26:00 +00:00
Daco Harkes 29a3e27e6f [tests/ffi] Switch over Android & QEMU to nnbd tests
This CL switches over the bots that are manually configured to
run the `ffi_2` test suite to the `ffi` test suite instead.
This changes these tests from legacy to nnbd mode.
The suites being converted are the Android and QEMU FFI tests.

This CL does _not_ switch over the bots that run the default suites.

This CL also skips all FFI tests that use the Dart API symbols on
Windows precompiled. These tests will never work in that mode and
should be skipped instead.

Analysis of FFI test bots: go/dart-ffi-legacy-test-turndown

Bug: https://github.com/dart-lang/sdk/issues/50633

Change-Id: I4e21ad5a036b83d8240fc662ed1c159305f2e297
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277521
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-12-27 15:18:59 +00:00
Ryan Macnak cb478b21f4 Don't mutate argument to dart:developer's postEvent.
Bug: https://github.com/dart-lang/sdk/issues/50713
Change-Id: Iadc3eb0b4306d7500a03bd77b8b6dc3c19227200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275984
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-12-22 23:10:13 +00:00
Kallen Tu d968d14314 [analyzer/cfe] Use the 'class-modifiers' flag for the 'mixin' class modifier.
Separating the class modifiers from the 'sealed' modifier.

Change-Id: Ifec865c9f612b147706be9b7c797167ef6788e90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277043
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-22 17:49:58 +00:00
Jackson Gardner ce741bb017 [dart2wasm] Emit closures and contexts for subexpressions of asserts.
Change-Id: Ibe0741d360caa4747ad4a3eea888b1a9661af111
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277050
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2022-12-22 16:27:39 +00:00
Jackson Gardner 061a9fbefb [dart2wasm] Add --enable-asserts flag.
Change-Id: I4cc9a55673374926e8b19cccf2be9888f166553d
Bug: https://github.com/dart-lang/sdk/issues/50801
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276772
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-21 19:53:14 +00:00
Brian Quinlan 9b2b9df09e [io] Remove incorrect docs that listSupport is not available on Android.
Bug:https://github.com/dart-lang/sdk/issues/47894
Change-Id: Id79a37f5ba6a8118a30d2297c95cff5a7ca1a03f
TEST=unit
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276660
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-12-21 00:23:02 +00:00
Nate Biggs 398d47cd10 [dart2js] Add priority to dartDeferredLibraryLoader hook.
Change-Id: Ib77b20fc56aa67b4f3318f9dcd8fa65b62c56509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275800
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-20 15:39:09 +00:00
Abitofevrything bc8606c34e [io/websocket] Cancel ping timer when WebSocket closes
Closes https://github.com/dart-lang/sdk/issues/50517

Change-Id: I04ea0f1b79e49aeab6c5fd049460335f0d02253e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274544
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-12-20 01:01:16 +00:00
Josh Soref 17ccbecc61 Spelling tests language
Closes https://github.com/dart-lang/sdk/pull/50763

GitOrigin-RevId: ee6187bc11c8211402b6aa722eb2c0826cba3d5b
Change-Id: I598004024a89e25710b9f16749ffb7c6fd6753c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276340
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2022-12-19 16:30:06 +00:00
Josh Soref a8cb0b4f98 spelling: compliance
Closes https://github.com/dart-lang/sdk/pull/50762

GitOrigin-RevId: e85b436a4cb108176273ffeffd96cc4ba84df444
Change-Id: I391df2dfb65c69c658965d9ebfd2d2314841044c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276320
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2022-12-19 13:22:28 +00:00
Josh Soref df97aca1fa Spelling tests
Closes https://github.com/dart-lang/sdk/pull/50764

GitOrigin-RevId: ee2fe9a75d50e877f4ad2fe3743acdbc04f186ef
Change-Id: Ia73cd22da4e6ec95e84772aa4e1345ce2dbde215
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276360
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2022-12-19 12:56:47 +00:00
Riley Porter b6388f2ea0 [JS interop] Expose more JavaScript operators in js_util
Exposes helper functions in js_util to access the JavaScript operators
`delete`, `||`, `&&`, `!`, `!!`, and `typeof`.
Change-Id: I0676b143aa004c7b4ed1c6b695b8d1e78a60778d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276028
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-12-17 00:31:27 +00:00
Nicholas Shahan d0d2e2591f [3.0 alpha][test] Remove use of NullThrownError
Change-Id: Ia28b44a9acdcb9a38ebb101029dc50b58d272b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275786
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-12-15 23:33:18 +00:00
Lasse R.H. Nielsen 2274ce9b05 Retire experiment flags introduced in 2.18.
Change-Id: I660bbf09c758f88589a10b0334ddd34c0620460d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275244
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-12-15 13:18:50 +00:00
Michael Thomsen e4cc3c98e5 [3.0 alpha] Remove deprecated dart:core List() constructor.
TEST=ci

Bug: Contributes to https://github.com/dart-lang/sdk/issues/49529
Change-Id: Ic129ef2d89f625d9ec6a7a1c301cffddd60b2ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-12-15 11:36:22 +00:00
Alexander Markov 7ebd4dd61c [3.0 alpha] Remove deprecated public class CyclicInitializationError
This deprecated class cannot be removed just yet because
we still need to throw something in case of cyclic initialization
in Dart legacy libraries (which are still supported).

Class CyclicInitializationError is copied for each implementation
(VM, dart2js and DDC) and made private. Each implementation now has
an independent private class which can be removed separately.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I8100bbe16636c12c4cbabbb5fe770f4c648c4249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275120
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-15 11:20:58 +00:00
Ryan Macnak 98af4110ad [vm] Increase supported range of TypeParameters to 16 bits.
TypeParameter::set_index was already asserting for 16 bits but silently truncating to 8 bits. The size of TypeParameter does not increase due to allocation rounding.

Add explicit range check to class finalization.

TEST=ci
Change-Id: Id4017f74b7dba47b00d64e77e787712c70290dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275560
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-14 23:34:18 +00:00
Nicholas Shahan faf8027465 [tests] Update expectation to TypeError
TypeError is now expected in the place of NullThrownError which is
being removed in Dart 3.0.

Change-Id: Ibb7188d993216067650d4b994a303f2bcd1d2298
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275742
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-14 21:37:27 +00:00
Sam Rawlins a5392b932b Re-categorize all SDK_VERSION_* codes as StaticWarningCode
Change-Id: If7a83f9f3258ce369dbe3142fcd5c088d6d88e40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-12-14 16:14:38 +00:00
Kallen Tu 120bfdc076 [analyzer/cfe] Parse 'mixin class' behind sealed flag.
Allow 'mixin class' modifier which allows a class to be used as a mixin.
https://github.com/dart-lang/language/blob/master/working/base-interface-final/feature-specification.md

Change-Id: I6b4dac75f2ff09b7ef833c5e015b1baf7fa3883b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275144
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-14 15:41:58 +00:00
Ömer Sinan Ağacan 0bb3b53194 [tests] Update a test for dart2wasm
The test stacktrace_current compares two stack traces by masking any
line numbers.

With dart2wasm, V8 shows function offsets instead of line numbers, in
hex, which causes the test to fail with unrelated changes.

This updates the regex to mask hex numbers as well, making the test
stable with unrelated dart2wasm changes.

Change-Id: I8dd951d4bf29fe39b6ec5d8de7bf2c9c37a5b5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275600
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-12-14 13:41:46 +00:00
Jackson Gardner 1306a4c284 [dart2wasm] Add intrinsics for bitwise operations on booleans.
Change-Id: Ic09545535c954d72615ca035ed1b133fada5d733
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275080
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2022-12-13 23:07:40 +00:00
Kallen Tu 93c3737674 [tests] Allow using classes as mixins within the same library and update a few language tests.
Change-Id: I4488b3ee7d04fe3a9c34ee3046f96e73984c0541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274602
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2022-12-13 18:29:58 +00:00
Daco Harkes c3fce2f559 [test/ffi] Free pointer allocated via malloc
Closes: https://github.com/dart-lang/sdk/issues/50705
Change-Id: I96d0bdf5e7fe95b8841d9c7ba3db8e785574222e
Cq-Include-Trybots: luci.dart.try:vm-kernel-asan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275260
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-13 16:41:47 +00:00
Dan Chevalier fd6fa010ec [ VM Service / DDS ] Add custom service stream support (Revised)
NOTES:
Original CL: https://dart-review.googlesource.com/c/sdk/+/274061
Revert CL: https://dart-review.googlesource.com/c/sdk/+/274802

Regression tests that failed after merging Original CL:
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release/24046/overview
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release-arm64/5999/overview

----------
DESCRIPTION:
Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.


The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.

TEST=Made sure that regression from original PR could be reproduced, and then resolved by applying this change. Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients

https://github.com/flutter/devtools/issues/4533

Change-Id: I2b04a84b4daf11dd9d72f899928b5e1f62a5ae02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275121
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-12-13 16:31:37 +00:00
Erik Ernst 010b3dff91 Update type variable cases in the regression_49396_test
The definition of flatten was adjusted in
https://github.com/dart-lang/language/pull/2696
such that it better preserves the type information when the type of `e`
in `await e` is a type variable. This CL changes the test to expect
the behavior of the newly specified flatten.

The test has been renamed to 'await_flatten_test.dart'.

Change-Id: Iaf67a53cd3cd181bcb3eb6e85beca7cc1af4d34a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274682
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-12-13 15:39:40 +00:00
Ryan Macnak de310a0c7b [vm, compiler] Fix address encoding limit when loading type arguments.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50671
Change-Id: I3a5ab9492d74fa770efd8e4c7cf90002a3793b9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275081
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-12-12 23:23:53 +00:00
Daco Harkes e3e355e16a [vm/ffi] Fix FfiTrampolineData GC bug
This lets the GC visit FfiTrampolineData::c_signature again.

https://dart-review.googlesource.com/c/sdk/+/272201 stopped adding
FfiTrampolineData::c_signature to snapshots. However, instead of
skipping it manually in app_shapshot.cc, we skipped it in
raw_object.h, which also caused the GC to skip it.
This CL adds it back in as we need it in JIT snapshots. This way we
keep it consistent between AOT/JIT snapshots.

TEST=tests/ffi/regress_b_261224444_test.dart

The c signatures of FFI trampolines were not properly traced in the
precompiler, causing us to hit an assert when the classes mentioned in
those types where only referenced from a signature and not retained
for any other reason.

TEST=tests/ffi/native_assets/process_test.dart (dartkp)

Closes: https://github.com/dart-lang/sdk/issues/50678
Bug: b/261224444
Change-Id: I84fc880744c2045ea3e2ef4f37df454b80b2faeb
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274387
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-12 15:46:33 +00:00
Lasse R.H. Nielsen 767049139a [3.0 alpha] Remove deprecated dart:core apis
- Remove `proxy` and `Provisional` annotations.
  - Remove `Deprecated.expires` getter.

Change-Id: I4521b48bb92e5f8420c778686f4efa9c6426cebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258004
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-12-12 11:46:58 +00:00
Dan Chevalier 3ed65601b0 Revert "[ VM Service / DDS ] Add custom service stream support"
This reverts commit 4981cbffe2.

Reason for revert: Mac regression test failed.

Original change's description:
> [ VM Service / DDS ] Add custom service stream support
>
> Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.
>
>
> The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.
>
> TEST=Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients
>
> https://github.com/flutter/devtools/issues/4533
>
> Change-Id: I870dc634c9a9a7d2ee3a6605319c2a18517ad197
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274061
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Dan Chevalier <danchevalier@google.com>

TBR=bkonyi@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,danchevalier@google.com

Change-Id: Ia1dce25444a6329c0553c931c9a6dbbec65ee583
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274802
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
2022-12-12 11:24:37 +00:00
Michael Thomsen b3304af17d [3.0 alpha] Remove deprecated onError API on int.parse, double.parse, and num.parse
Change-Id: I9ed24c380bf716cb893b99ba228e34f4671cc8fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259042
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-12 09:54:54 +00:00
Michael Thomsen 4028b9b0fe [3.0 alpha] Remove deprecated NoSuchMessageError API
Contributes to https://github.com/dart-lang/sdk/issues/49529

Change-Id: I2cef41b991c59869f606235929347449e17022cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271082
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-12-12 09:48:05 +00:00
Chloe Stefantsova a46de1c30c [cfe] Add implicit null-check on throw
Throwing `null` is not supported in sound null safety. This change
inserts an implicit `as Object` cast that result in a TypeError, rather
than a NullThrownError, in sound mode.

Closes https://github.com/dart-lang/sdk/issues/49198

TEST=Covered by the existing tests

Change-Id: I041baf95becd2df1b940fdff7cde398a4e391ee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247546
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-12-12 00:48:13 +00:00
Dan Chevalier 4981cbffe2 [ VM Service / DDS ] Add custom service stream support
Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.


The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.

TEST=Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients

https://github.com/flutter/devtools/issues/4533

Change-Id: I870dc634c9a9a7d2ee3a6605319c2a18517ad197
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274061
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
2022-12-09 20:18:30 +00:00
Michael Thomsen 9f2a622d79 [3.0 alpha] Update CFE messages for Dart 3 sound null safety by-default
Fixes https://github.com/dart-lang/sdk/issues/50638

Change-Id: I511c5337099ae9576377ac8a82ef1bb78f6d34b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273844
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-12-09 16:55:03 +00:00
Sigmund Cherem c91b73eaf7 [3.0 alpha] Remove dart:html's deprecated document.registerElement & registerElement2 APIs
Change-Id: I07fc124c55d1aeb678f39a4d72d3b4f581025a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273541
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-12-09 16:02:02 +00:00
Nicholas Shahan f0c270e96d [ddc] Temporarily skip tests that timeout
The timeouts are crashing the test infra when trying to deflake
the failures and preventing more results from getting uploaded.

These tests are timing out right now on the canary bot because
support for the new runtime types hasn't been fully landed. They
should be enabled again after all the support has landed and
should have results at parity with the non-canary configurations.

Change-Id: Ia8814c02445acccb906c4b376c82da88480155b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274483
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-09 02:29:31 +00:00
Alexander Aprelev fb22336c28 [vm/sse41] Fix use of pextrd when sse41 is not available.
BUG=https://github.com/dart-lang/sdk/issues/50640
TEST=ci

Change-Id: Ief12c270cb59dace99e3a2845cb44ed5085dbdaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274081
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-12-08 23:29:14 +00:00
Kallen Tu b58f1b4ef3 [analyzer] Report error when mixing in a sealed mixin outside of its library.
Change-Id: I62be6c21bc2bf2a5af35203137aa75c7fd1ba934
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274142
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 21:18:24 +00:00
Ryan Macnak 0150cddace [vm] Fix call-through-getter runtime handling.
This should look for `dyn:call` instead of `call`. If it was a non-dynamic call, we would hit an invoke-field-dispatcher instead.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/116405
Change-Id: I98c441fec2eb53ab23ac1dd52db3aa4eaa5cbc6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274265
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-08 17:48:49 +00:00
Aske Simon Christensen ad06d73ace [dart2wasm] Use a flat index space for function type parameters
The current two-level indexing scheme for function type parameters
(depth and index) breaks down in the case of type substitution when
the substituted type is a generic function type, since its internal
type parameter types have been encoded assuming that the function type
had nesting depth zero, but after substitution its nesting depth can
be higher.

Relative indexing schemes such as De Bruijn indices will also not
work, since function type parameter types are constant types, and the
constant infrastructure assumes that the same constant always has the
same representation.

This change introduces a flat indexing scheme where function type
parameters are indexed using a single index which is independent of
the context in which the type parameter type appears. To avoid
collisions in the case of nested generic function types, every function
type has a type parameter offset, which conceptually shifts the
indexing range of its type parameters so it doesn't necessarily start
at zero.

Looking up a function type parameter in its environment thus involves
searching outwards until a function type is found whose type parameter
index range contains the index encoded in the function type parameter
type.

Change-Id: I544056d52711ff829b170f78a7274a93871825a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272361
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Aske Simon Christensen f72f2e92d5 [dart2wasm] Re-enable async tests that no longer time out
Issue: https://github.com/dart-lang/sdk/issues/50122

Change-Id: I311c7a709e74381c84cb9c42cceb3d5c9cde4d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267960
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-12-08 13:43:41 +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
Konstantin Shcheglov fd30c4f269 Report XYZ_FROM_DEFERRED_LIBRARY during constant evaluation.
Change-Id: I3cf2fa1dfcee3d9a2ddc6d506465d26a40181524
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 00:19:34 +00:00
Alexander Markov 66f1dee48c [vm] Runtime type check in await
'await e' should check that e is a Future<flatten(S)>, where S is a
static type of e before awaiting e. If e is not a Future<flatten(S)>,
then 'await e' should await Future.value(e) instead of e. So futures
of incompatible type are not awaited and soundness is not violated.

TEST=tests/language/async/await_type_check_test.dart
(Based on https://dart-review.git.corp.google.com/c/sdk/+/267422.)

Fixes https://github.com/dart-lang/sdk/issues/50529
Part of https://github.com/dart-lang/sdk/issues/49396

Change-Id: Ia418db1be6736710abc9be87d95584c50cbc677e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273002
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-07 22:46:22 +00:00
Kallen Tu 7ff20a67ca [analyzer] Report error when subtyping a sealed class outside of its library.
Change-Id: Iee6c9120d096ed49592ca3d155c81c876ceb5c34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273832
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-07 22:00:28 +00:00
Martin Kustermann 4be2981c2d [vm/ffi] Ensure there's a single Function object per ffi-callback + exceptional-return combination
Right each `Pointer.fromFunction()` invocation will lead to creation of
a new ffi trampoline function & it's following JITed code. In AOT we
have exactly one ffi trampoline per target/native-signature/exceptional-return
combination.
=> This CL ensures we have only one such function.

Furthermore each `Pointer.fromFunction()` will currently perform 2
runtime calls in JIT: One to create a `Function` object, the other to
JIT that function & register callback metadata.
=> This CL ensures we won't do a runtime call to get a function, instead
   do it at compile-time (as in AOT)

Furthermore we eagerly assign a callback-id to the unique/deduped ffi
trampoline callbacks. Only when the application requests a pointer, do
we populate metadata on the `Thread` object.

This CL doesn't (yet) change the fact that in JIT mode we have
isolate-specific jit trampolines (that will call now shared ffi trampoline
functions).

We also avoid baking in C++ runtime function pointers in generated
code. As a result we can now preserve ffi trampolines across AppJIT
serialization.

As a nice side-effect, we remove 100 lines of code.

TEST=ffi{,_2}/ffi_callback_unique_test

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

Change-Id: I458831a47b041a088086f28f825de2a3849f6adc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273420
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-12-07 20:47:13 +00:00
asiva e70e2bc1b7 [Dart 3.0 alpha] Fix some test issues (legacy mode argument not passed in)
TEST=ci

Change-Id: Iebb31a509b99837e41cf3823ca366c1560777af6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273920
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-12-06 19:34:47 +00:00
asiva 606a64a743 [3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.
- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-06 04:04:23 +00:00
Alexander Thomas 7e0d92d69d [3.0 alpha] Bump version to 3.0.0
Tested: Standard CQ.
Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I329b9940db7309c7e48f17eecd7a66d5b853a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271922
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-06 02:40:36 +00:00
Erik Ernst ac68a593d4 New test, testing the behavior under scrutiny in SDK issue 49396
Change-Id: I1ebb2ea12f4d01c4077fca6fc380353f821bc68a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267422
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-12-05 09:40:08 +00:00
Kallen Tu 6c9873bf42 [cfe] Report error when using a class as a mixin when sealed-class is enabled.
From the changes in dart-lang/language#2674 that specify from a certain language version, we would like classes to not be used as mixins unless specified as a 'mixin class'.

Currently, this behaviour is under the sealed-class flag. May be subject to change as the other modifiers are added, but I'd at least like to make sure this works for sealed classes.

Change-Id: I5754b383327dde06d49175fe2d05c8ba7462145f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273082
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-02 22:31:58 +00:00
Kallen Tu 1c0cb35a87 [cfe] Allow mixin 'on' behaviour for sealed supertypes.
Implements the behaviour discussed in dart-lang/language#2600. All other mixin application or implementing behaviour for sealed families should be unaffected.

Change-Id: I95577d8b2bc69e6c1a365ec43fb156f5d5d9a259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-01 01:18:40 +00:00
Ryan Macnak f4b34ad31b [vm, gc] Add missing promotion of Finalizer external size. Remove race incrementing external size.
When a FinalizerEntry's target gets promoted, the associated external size needs to also get promoted. We were handling the cases where the FinalizerEntry itself was either already old or remained new, but not the case where it was promoted. Failing to promote the external size meant that when the finalizer was collected, external size was subtraced from old space that was still being attributed to new space, so the old space total external size became negative.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50537
Change-Id: Id2fe2d748311de73f04de367c9cd153d87b74ad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272350
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-30 17:14:59 +00:00
Alexander Thomas 2a035279af [3.0 alpha] Use equals for default values in the SDK
The colons cause test failures when the language version is bumped to 3.0. This CL can be landed before the 3.0 version bump.

Bug: https://github.com/dart-lang/language/issues/2357
Change-Id: Id8396034b16adc18b476689314e28b9617d25f18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272200
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-11-30 10:33:31 +00:00