Commit graph

22880 commits

Author SHA1 Message Date
Stephen Adams f67fe44495 [web-fixit] Avoid a few tests in production mode
Fixes:
language/control_flow_collections/await_for_test
Change-Id: I701c5455af4c5910c3cbaec06d1c75d35e87c597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338648
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-11-29 21:28:58 +00:00
Stephen Adams 5a2ef55808 [web-fixit] Don't test covariance checks in production mode
Exit early for dart2jsProductionMode.
Remove multitest markers.

Change-Id: I9ccf1b3495823b8de3965f1c0b177ce4643c84f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338587
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-11-29 21:19:49 +00:00
Nate Biggs 1a12bf063a [dart2js] Fix language/closure/minify_closure_variable_collision_test
Was failing to compile because `array` was a List<A> so indexSet on line 32 was invalid.

Change-Id: I555a2c341e0d9dec5e85d92ecc855d073f134694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339060
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-11-29 19:51:42 +00:00
Nate Biggs 40f580ec1c Remove unnecessary print in corelib/uri_base_test.dart.
Change-Id: Ibbcc36c72d40fd466f735ec098eaf1365cf5fb96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338980
Auto-Submit: Nate Biggs <natebiggs@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2023-11-29 17:37:28 +00:00
Nate Biggs f773c42087 [dart2js] Add 'org-dartlang-d8-preamble' as possible Uri.base scheme in corelib/uri_base_test
Change-Id: Ibf9b43297c15b80d56d8dbc78b9d69c44eb76793
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338701
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-11-29 03:29:31 +00:00
Nate Biggs be77b44e63 [dart2js] Update corelib/ tests that are using int64 literals to use a calculated value instead.
Change-Id: Id765d6682bf902c913093eca2ac4979d9596d4b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338720
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-11-28 21:54:28 +00:00
Vyacheslav Egorov 775b7bdd73 [tests] Update two conditional import tests
These tests were just failing on the VM for a very long time.

Rewrite them into a simpler version that just tests conditional
importing rather than trying to do clever things with HttpRequest.

R=eernst@google.com

Change-Id: Iebb7f6210ae4f2215c9445695189533116ffb5b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338160
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-11-28 14:27:39 +00:00
Vyacheslav Egorov 7348441514 [tests] Fix language/bool/has_environment_not_new
This test always fails on the VM because unlike other
targets VM allows to invoke this constructor with `new`.

Instead of having an always failing test change this test
to test VM's current behavior. This will also allow us to
catch breaking changes in the future.

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

R=eernst@google.com

Change-Id: I4ba63dc94d2bd824df44c604b0ca1c57eb8bd559
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338124
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-11-28 12:50:05 +00:00
Vyacheslav Egorov d15f56162f [tests] Update language/deferred/not_loaded_check
Change this test to match the current CFE implementation
which has been in place for 5 years (e2ad2db805)

We should probably update specification instead of changing
CFE: https://github.com/dart-lang/language/issues/3481

R=eernst@google.com

Change-Id: Iccbecfa8c29733b3e163d2b13d4df79e277999fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338125
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-11-28 12:45:45 +00:00
Stephen Adams 1016d2f293 [web-fixit] Use generic types in control-flow-collections tests
Use generic types in type tests. This causes types to be retained.

Fixes:

language/control_flow_collections/if_inference_test
language/control_flow_collections/map_set_ambiguity_test

Change-Id: Ie8fe93320ec623cc3812d43bd36550a0fe32f613
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338424
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-11-28 02:16:39 +00:00
Srujan Gaddam 51f4c2dd60 [dart:html] Remove cache_test
Closes https://github.com/dart-lang/sdk/issues/54118

ApplicationCache is a deprecated browser API, and this test
is failing on almost all web configurations. There's nothing
to test, so this should be deleted.

Change-Id: I582ae44e23bfaa1198bd5e57236340b552380ba5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338427
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-11-28 01:45:57 +00:00
Vyacheslav Egorov 48f29b15c7 [vm/aot] Make regexp/stack-overflow test pass
This test needs a larger backtracking stack then we provide
by default in AOT mode. Allow controlling stack size via
a command line flag regexp_backtrack_stack_size_kb.

Additionally cleanup types in the interpreter a bit: generated
code uses Int32List for both register and backtracking stack.
But the interpreter was using intptr_t for backtracking stack
and int32_t for registers. Align these types to use int32_t
everywhere and add a bit of sanity checking to ensure that
we don't try to use regexp engine with strings which are
too big to fit into int32_t range.

TEST=corelib/regexp/stack-overflow

Change-Id: I5c13c4b47d5d478b683f0450d3c0ce65f6961cff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338141
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-11-27 15:22:40 +00:00
Erik Ernst 8eaeb87500 Correct 4 static type expectations in test
Work on https://github.com/dart-lang/sdk/issues/54002 revealed that the
test least_upper_bound_greatest_closure_1_test.dart contains 4 static
type expectations that are incorrect according to the definition of `UP`
and this CL corrects those expectations.

The updates associated with 54002 will change the behavior of the cfe
and the analyzer such that they have the correct expectations (they
currently succeed with the incorrect static type expectations, that is,
they need to be updated in order to compute `UP` correctly, but that
will occur as part of the update described in 54002, so we will
approve the test failures caused by this CL and refer to 54002).

Change-Id: Iec6ba253eea9f85efc8af67b372bd7f160145a22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337726
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2023-11-27 10:38:31 +00:00
Alexander Thomas 38a60342ec [infra] Delete co19_2 directory
Bug: b/310114753
Change-Id: I9921031badd36942e860ad7266236d521434e366
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338181
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-11-27 09:11:09 +00:00
Vyacheslav Egorov af0670c174 [tests] Tweak ffi/unaligned_test to reflect decision made in #45009
Skip float and double access tests on ARM because they will
always trigger alignment traps. These traps might or might not
be hidden from the user depending on the specific OS configuration,
e.g. many Linux distrubutions choose to perform fixup in the kernel,
but Android disables that. Similarly there is a difference in QEMU
behavior depending on QEMU version.

Change-Id: Idca9553486e0f479ec1a32c25131d3d1bd4ef74d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338140
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
2023-11-24 11:17:03 +00:00
Alexander Thomas 096bde2a4d [cleanup] Remove co19_2 and other references to _2 suites
Bug: b/310114753
Cq-Include-Trybots: luci.dart.try:dart2js-hostasserts-linux-unsound-try,ddc-linux-chrome-unsound-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,front-end-linux-release-x64-try
Change-Id: I45ebfda5d746f12ca0fa3c0003c299720f1c7179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337180
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-11-22 11:15:57 +00:00
Moritz a3568286ff Adding the resource-identifier functionality from the compiler to the
vm.

This identifies all calls to static methods annotated with
`@ResourceIdentifier`, collects the constant arguments passed to the
method, and writes the results into a file.

The purpose of this feature is to be able to pass the recorded
information to packages in a post-compilation step, allowing them to
remove or modify assets based on the actual usage in the code prior to
bundling in the final application.

Tested: pkg/vm/test/transformations/resource_identifier_test.dart
Change-Id: I58cb313b66ee23c1d154dcc242547723a1ced359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329961
Commit-Queue: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-11-21 15:05:35 +00:00
Alexander Thomas 6b0ce926d1 [cleanup] Remove references to "nnbd" from FFI test generator
Bug: b/310114753
Change-Id: I69cc48cc8f4dec7e08d8f73f0cc5e9060f18a4b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337320
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-11-21 09:03:19 +00:00
asiva 70711931c7 [VM/tests] Remove references to ffi_2 from test generator
Last part of cleaning up references to ffi_2 as these test directories have been deleted.

TEST=ci

Change-Id: Ia3ac0edeec843e5057c8c162adb9806f46c40968
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336243
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-11-20 20:16:14 +00:00
Daco Harkes df4ef72c01 [vm/ffi] Remove deprecated FfiNative
TEST=pkg/analyzer/test/
TEST=CI build with class removed from `dart:ffi`

Closes: https://github.com/dart-lang/sdk/issues/53923
CoreLibraryReviewExempt: VM & dart2wasm only.
Change-Id: I45a39b623754f9f1b65cac55ea9adae390199f5d
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm64c-try,analyzer-analysis-server-linux-try,analyzer-mac-release-try,dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336960
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-11-20 13:16:28 +00:00
Robert Nystrom 2ee771a4f6 Remove the legacy "_2" tests. \o/
I also cleaned up a bunch of places that referred to them.

Change-Id: I45f68818c892f8620ea04257885ffa3763374bb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335863
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-11-17 20:17:23 +00:00
Daco Harkes c6f70abd3e [gardening] Fix status file
Fix typo on https://dart-review.googlesource.com/c/sdk/+/336882.

Change-Id: Ic59ecea2f6632f0c686e36f66c33e2c934a4cc5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336883
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-11-17 14:06:22 +00:00
Lasse R.H. Nielsen a1783a9c34 String.fromCharCodes allows start and end after end of iterable.
The current `String.fromCharCodes` behavior, throwing if `start`
or `end` is larger than the length of the `charCodes` iterable,
is inconsistent with the argument being an `Iterable<int>`,
which the user is not expected to know the length of.

Most other operations that accepts or produces an `Iterable` and
restricts it to a range, will allow the range to exceed the length
of the iterable, acting like `.take(end).skip(start)`, just without
needing to create wrappers that hide the original value.

(`List.setRange` is another exception, and should probably be fixed
by allowing the range to be partially filled, since it's too hard
to change it to require a `List` argument.)

Fixes #50253, #53937

Tested: Added to `corelib/string_fromcharcodes_test.dart`
Bug: https://dartbug.com/53937, https://dartbug.com/50253, https://dartbug.com/23282
Change-Id: Ie19c5fa8e715ea1c58c9c77c247f2a563654c1aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333921
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-11-17 13:34:22 +00:00
Lasse R.H. Nielsen 5543293a16 Reland "Expire 3.0.0 experiment flags."
This is a reland of commit 6f29e7fce4

Original change's description:
> Expire 3.0.0 experiment flags.
>
> TEST=Existing tests covers.
> Change-Id: I161eefdc28c74f63ba1ee926800a01eea03d9930
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331960
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

TEST=Existing tests covers.
Change-Id: I384e77744c74774a250be413358a7fa176117167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332684
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-11-17 13:10:01 +00:00
Daco Harkes 4f5a6c8530 [ffi/test] Skip handles test on Win AOT
Closes: https://github.com/dart-lang/sdk/issues/54072
Change-Id: Id9babd0ca9e4c6de35104b975bf7acbd9b1564ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336882
Reviewed-by: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-11-17 10:54:02 +00:00
Paul Berry 18b5f25052 Use OWNERS files to restrict editing of tests/language to language team.
Also tests/language_2 (which hopefully we can delete soon).

Change-Id: I4c7086ecb1b374c2068be9d1366f76323435e57f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336624
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-11-16 18:18:00 +00:00
Daco Harkes c6a85b81f4 [vm/ffi] Tests with Handles and constants
Adds tests to cover constant values flowing into `Handle` parameters
of `@Native external` functions.

The first test is a repro of the failure from
https://dart-review.googlesource.com/c/sdk/+/333840

The other tests construct more extreme cases.

Handles can't be passed to leaf functions, so no `isLeaf`.

Split off reland:
https://dart-review.googlesource.com/c/sdk/+/333841

TEST=tests/ffi/ffi_native_handles_test.dart

Change-Id: I89d31a940f5a63793a03a9eb364231a54164a328
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336661
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-11-16 16:44:59 +00:00
Chloe Stefantsova c6b0e218c7 [cfe] Make extension type non-nullable only if it implements Object
Part of https://github.com/dart-lang/sdk/issues/49731

TEST=existing

Change-Id: I397bbd5ca7868a9fb344286c910536c6ac341222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333500
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-11-15 14:02:35 +00:00
Ryan Macnak c5c578e671 [vm, ffi] Don't read out-of-bounds when marshalling structs by value.
Switch the Windows ARM64 builds to use MSVC. Clang disagrees with itself about handling of small structs in variadic functions, allowing splitting between the last argument register and the stack as the callee but not as the caller.

TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-linux-release-arm64-try,vm-mac-debug-arm64-try,vm-mac-release-arm64-try,vm-win-debug-arm64-try,vm-win-release-arm64-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-ia32-try,vm-linux-release-ia32-try,vm-win-release-ia32-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-mac-debug-x64-try,vm-mac-release-x64-try,vm-win-debug-x64-try,vm-win-release-x64-try
Bug: https://github.com/dart-lang/sdk/issues/52644
Bug: https://github.com/dart-lang/sdk/issues/53829
Change-Id: I2fd6c40620a885479f11bb8528ca1e9df3948a2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331209
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-11-14 19:23:33 +00:00
Brian Quinlan 1b8382b14d Revert "Call the HttpClient constructor when connecting a WebSocket to allow HttpOverrides to work."
This reverts commit 92e7989fbc.

Reason for revert: Causes VmService WebSocket creating to fail because HttpClient is mocked during Flutter Widget tests. See https://github.com/flutter/flutter/issues/138413

Original change's description:
> Call the HttpClient constructor when connecting a WebSocket to allow HttpOverrides to work.
>
> One consequence of this is that there will be one HttpClient per WebSocket connection rather than one for all WebSocket connections. This does *not* affect connection pooling because the sockets are detached from the HttpClient after the WebSocket connection is made.
>
> Closes https://github.com/dart-lang/sdk/pull/52509
>
> GitOrigin-RevId: 28ca642a56e3bbc6112df844b07026b9e0ae8ae6
> Change-Id: I8d9c6f2a883b0f79bafca30abd1dfd98291cf0e0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305620
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Brian Quinlan <bquinlan@google.com>

Change-Id: Ie1d029e7acf477503cd601f6a03e121cd17d1695
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336100
Auto-Submit: Brian Quinlan <bquinlan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-11-14 16:32:50 +00:00
Nicholas Shahan 47b9e3e6df [tests] Add repro for cross module constant
There is an issue with cross module constant extension types that causes
the CFE to crash.

Change-Id: Id6af3a5400e55ecb2534ce71a07c5c1ecb17a46f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335384
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-13 22:21:40 +00:00
Sigmund Cherem 8d0b898d91 [tests][web-fixit] make int_modulo_arith_test aware of production mode.
The `gcd` method has a parameter of type `int`, when trusting
type annotations, we don't validate that the parameter is not
a `double`.

This change guards against this scenario and makes this test pass in
dart2js-production-linux-d8.

Change-Id: I70ab76b5b389d33c316b625ebb6188959a1ae949
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335620
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-13 20:13:04 +00:00
Brian Quinlan 92e7989fbc Call the HttpClient constructor when connecting a WebSocket to allow HttpOverrides to work.
One consequence of this is that there will be one HttpClient per WebSocket connection rather than one for all WebSocket connections. This does *not* affect connection pooling because the sockets are detached from the HttpClient after the WebSocket connection is made.

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

GitOrigin-RevId: 28ca642a56e3bbc6112df844b07026b9e0ae8ae6
Change-Id: I8d9c6f2a883b0f79bafca30abd1dfd98291cf0e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305620
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-11-13 19:46:09 +00:00
Ömer Sinan Ağacan 3939bf3dad [dart2wasm|js] Add element size tests for typed array to JS conversions
Change-Id: Ie7fe21630044ff2e76eee7a58fd22c95fcfd2f2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335041
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-11-10 21:25:25 +00:00
Nicholas Shahan b82465111c [test,ddc] Update library test to use static method
The test was relying on the runtime type representation to verify
that the library object returned from `getLibrary` was correct. Now
it uses the static `print()` method instead to avoid issues in the new
type system.

Change-Id: Iaa26427e46afd0e7f4ae0a84cb4c123755484647
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335023
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-11-10 20:39:00 +00:00
Alexander Thomas 57724af73a [test] Prepare symbolic links test for the removal of _2 suites
Bug: b/310114753
Change-Id: Id39362d267c9967ab679456c6f891700196f9170
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335444
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-11-10 11:45:16 +00:00
Sigmund Cherem 751a47f942 [tests][web-fixit] Fix date_time_extremes_test.
The test creates DateTime objects reusing the data from another
DateTime object, but on one case it didn't include the seconds and
milliseconds value.

When using the minimum date value, this omission made the copy to be
out of range, and as a result returned an InvalidDate.

Change-Id: I83f1d8a755e8d3a78ef0fd0468ee80e162c10545
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335400
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-10 02:00:18 +00:00
Sigmund Cherem 1cba9f344c [tests] Skip multiple html and co19/html tests.
All tests skipped here are flaking or timing out. Most of them fail for
a common reason tracked in
https://github.com/dart-lang/sdk/issues/53985: Chrome inactive tabs do
not run behave the same as active tabs. This means that interactions like
css transitions, requestAnimationFrame, and video play don't work as
expected.

This CL skips the tests only on Chrome, but continues to run them in
other browsers where the expectation is met.  If we can in the future
ensure tests are run on an active tab, we can consider reneabling these
tests. That said, the value of this tests was higher when we mantained
Dartium, but these days we may consider deleting them instead.

Change-Id: I9c0ea230fecca16fa008b64c2cf316ccdd0f53e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335030
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-10 01:20:39 +00:00
Alexander Aprelev e0751fb8aa [gardening] Use Platform.lineTerminator in remove_error_listener_test expectations.
Follow-up to https://dart.googlesource.com/sdk/+/088b178d9d464a3e89e6467dff37d80d4170e7fd

Fixes https://github.com/dart-lang/sdk/issues/54007
TEST=ci

Change-Id: I507de90fb46641af06890d052af0f8db29363473
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335326
Auto-Submit: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-11-09 22:54:03 +00:00
Srujan Gaddam a700d5f902 [dart2wasm] Handle extension types that wrap allowed types on external members
Users are allowed to have extension types on types that we allow
on external methods e.g. String. For most types, this doesn't make a
difference as we jsify for parameters and dartify and cast for return
types. The one place it does matter is when we check the static type
to do int conversions. Here, we should use the erased type instead.

Change-Id: Ibfcb0acc7f2c8a1ba3b52aa42000640982f11962
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335120
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-11-09 21:58:33 +00:00
Srujan Gaddam c050c8ac22 [dart2wasm] Fix various null toExternRef calls for JS interop
A lot of JS inline function calls were being passed null
instead of nullRef. Extension conversions are changed to better
handle WasmExternRef?s. There were a few spots in the
dart:js_interop_unsafe API surface as well that were not handling
nulls consistently.

CoreLibraryReviewExempt: Doc changes to backend-specific lib.
Change-Id: I08c5020e65156faed3841b0446aafb1e51242342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334380
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-11-09 21:58:33 +00:00
Alexander Aprelev 088b178d9d [vm/isolates] Ensure removeErrorListener makes exceptions unhandled.
BUG=https://github.com/dart-lang/sdk/issues/53850
TEST=lib/isolate/remove_error_listener_test

Change-Id: I442ea403671cd42275a2a420c2cb234c2c5fa126
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335321
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-11-09 20:46:59 +00:00
Sigmund Cherem 0a0dcce390 [tests] Mark closure/cycles_test as slow on chrome, skip on firefox.
Eventually we may want to revisit whether it is worth running this test
at all on the web backends. The test was designed to ensure the VM
didn't produce memory leaks when capturing state in closures, as such,
it may be better placed on a different suite.

Today, the test passes in most web configurations. The two exceptions
are:
  * ddc-linux-chrome is flaky and times out 50% of the time
  * ddc-linux-firefox consistently times out.

Locally, on a machine much faster than our bots, the former completes in
5s and the latter in 25s. In the last 60 days, the chrome configuration
has seen runs on the bots ranging from 8 to 60s (hitting the timeout). I
expect marking the test as slow will fix the flakiness on chrome, but
given that it is 5 times slower on FF, I fear it may not be enough to
make the test pass in FF.  Given that it doesn't provide much value to
also have the coverage in FF, I'm inclined to skip it there instead.

Change-Id: Ice25eb401b6af3c6ab8ba3f4b43bf3ce9ee38c83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335020
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-08 18:43:51 +00:00
Nate Biggs 9eba05482b [dart2js] Fix list tracing treating first/last setters as type preserving.
I suspect that when the list of type preserving selectors was created the first/last setters either didn't exist or were just overlooked. Any dynamic List could have its inferred type changed by these operations.

Due to Dart2js's type representation this bug affects more than just dynamic lists. We track some simple values as part of the type system. So an operation that modifies a value can technically modify the type, as Dart2js represents it, even if the "real" type is preserved.

In the added test we would represent the list literal's type as "List(length: 2, elementType: Bool(true))". Notice the type states the elementType is specifically true, not just bool. Thus the first/last operations are modifying that type. But since we aren't registering this type change, SSA optimizes away the call/index and inlines the element itself.

Interestingly, this primarily manifested for bools due to a check in SSA:
https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/ssa/optimize.dart#L475

In that code we are inlining constant-like expressions for the arguments of static invocations (such as the argument to a Expect.isTrue call). However, a few lines earlier you will see we only inline bool constants:
https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/ssa/optimize.dart#L467

So when the list element type is anything other than a bool, this inlining does not trigger thus avoiding the bug.

Bug: https://github.com/dart-lang/sdk/issues/53944
Change-Id: I4e893903f335fc99b13cf526736c27bb066a4bad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334420
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-11-08 03:50:21 +00:00
Sigmund Cherem 51fa4aaac8 [tests] follow up comments on peridic_timer tests
Address comments from Lasse in
https://dart-review.googlesource.com/c/sdk/+/331210. Namely:

* Use 100ms for the interval, so avoid overlap with the safety-margin of 40ms
* Rewrite comment to only discuss the safety margin in terms of an early
  dispatch
* Only use the safety margin on web backends. Unlike timer_test, I am
  using the presence of `dart.library.js` instead. Going forward it's
  possible that dart2wasm hits this issue if it relies on browser's
  timers.

I also copied the changes to lib_2 since flakiness is seen there too.

Change-Id: I71b6365346cccc7667dbe3da809b1bfd192ff38a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333057
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-07 17:47:20 +00:00
Nicholas Shahan 8c4d6c6484 [ddc] Normalize name of Event type in test
Change-Id: Ie209907f982f2eba8e3699aeb066f4cbc98cf13e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334006
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-11-07 00:50:20 +00:00
Nicholas Shahan 2ef46a1fff [ddc] Fix custom formatter for classes
Classes were mistakenly being formatted by the function formatter.

Change-Id: I6c513803c7c211f02bb9267914b5988cd6c02c5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334005
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-11-07 00:48:58 +00:00
Nicholas Shahan 406e92dba6 [ddc] Remove implements text from custom formatter
Change-Id: I814dfc5b80ae3d59ad3ad53d22c4d40866c6d926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334004
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-11-07 00:38:34 +00:00
Nicholas Shahan c50fcf8828 [ddc] Show "any" for type args of package js types
Ensures that `toString()` of types that contain embedded js types 
will appear the same in the old and new runtime type systems.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I71ec0e13943281e745bcf05e10aa36d093cbc0c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334003
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-11-06 22:13:17 +00:00
Stephen Adams 048c7b036b [js_runtime] Polyfill WeakReference and Finalizer for ancient browsers
Dart does not officially support browsers before the introduction of WeakRef and FinalizationRegistry but there are users of Dart that have a few customers still using these browsers.

As a result, both ACX and Flutter have ad-hoc polyfills for these classes. Adding the polyfill in js_runtime will allow the other polyfills to be removed. The polyfill is as small as possible (omitting checks, avoiding extra Dart classes, detecting as late as possible), so it should be a net code size improvement of a few bytes for ACX and Flutter use cases.

The polyfill leaks memory by retaining the weak reference target and never calls the finalization callbacks. This is permitted behaviour.

Change-Id: I4f0d08ee6322dab26728d95ca8c24a7fd59b3314
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333304
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-11-03 22:15:38 +00:00