Commit graph

22324 commits

Author SHA1 Message Date
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