Commit graph

22282 commits

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