Commit graph

22860 commits

Author SHA1 Message Date
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
Brian Quinlan 258863c6d1 Fix a bug where proxy usernames/passwords containing @ were not correctly parsed.
Bug:https://github.com/dart-lang/sdk/issues/53157
Change-Id: I068fd770dac7f0f762cefbe8ca158fee8ba882fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333901
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-11-03 19:48:42 +00:00
Stephen Adams 4bc730b18b [tests] Make corelib/string_split_test conditional rather than multitest
corelib/string_split_test/checkedstore goes away.

Change-Id: I00ad3d42ef2c9798c2a76c6e8ca568954cb1e9f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333643
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-11-03 17:28:08 +00:00
Paul Berry ff437c9623 More thorough tests for field promotion in mixins.
These tests address the code review comments on
https://dart-review.googlesource.com/c/sdk/+/331750.

Change-Id: I79cd14d9cc3228011ba81638b4c1bafdcb8351d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332746
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-11-03 16:24:24 +00:00
Kallen Tu 988c301109 [analyzer] Issue 53927: Disallow final fields to be used in a const context.
Context: Added a field check in https://dart-review.googlesource.com/c/sdk/+/312347 which the goal back then was to cut down on more unnecessary errors, but this seemed to have caused a regression elsewhere.

Reverting this part of the change and other related tests.

Bug: https://github.com/dart-lang/sdk/issues/53927
Change-Id: I0774e050c73e677347caad836dd59c9cba71d044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-11-02 20:46:20 +00:00
Stephen Adams 3595f1e187 [tests] Update some tests for web numbers
Change-Id: I6cf7925779a93cae082e23c2bdf15ac36016eeb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333127
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-11-02 19:30:11 +00:00
Sigmund Cherem 11cf645f9c [tests] increase timeout for long dart2js test.
This test flakes 0.5% of the time due to long compilation times. It
seems to be intended to be a stress test, so increasing the timeout
seems reasonable.

Change-Id: I508b4e42654dbb01fba9d84bea3bf843d7b59c48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333320
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-02 17:22:39 +00:00
Sigmund Cherem 7e8a203f1e [ddc] use async-helper in ddc's hot_restart_timer test
This test returned a future, which in other runtimes may mean that
the test would not be awaited for. The test-runner for DDC does include
extra asyncStart/asyncEnd to ensure the test runs to completion.
However, this sporadically caused double reporting and flaky failures
([example][1]).

This change makes the test itself track the async nature of the test,
just like we do in most other tests today.

[1]: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8766055193681740753/+/u/test_results/ignored_flaky_test_failure_logs

Change-Id: Ib0edab197db21026d38b40036a1eeaf6edff5ad6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333300
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-11-02 15:37:14 +00:00
Stephen Adams 28a4b55c0a [tests/isolate] Avoid use of deprecated unmodifiable typed data view constructor
Issue: #53785
Change-Id: I205492adcec6432f5503cbf9f015a6ac2e9d6f5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332165
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-11-02 12:45:48 +00:00
Johnni Winther 12c4e22a4d [cfe] Handle various cases ExtensionType
Handles ExtensionType in inference of MapLiteral, inference of
ObjectPattern, and exhaustiveness.

TEST=tests/extension_type/*

Change-Id: I3284da2c69d875e192cf3f004ee1156e1aedd98b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333160
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-11-02 10:42:48 +00:00
Stephen Adams 248afd5d29 [tests] Migrate language/function_type/test_generator.dart
- Migrate language/function_type/test_generator.dart to null safety.
- Add logic to avoid some tests under `dart2jsProductionMode`.
- Re-run generator.
- `dart format` generated files.

Change-Id: I2d7fd787d0710ae2e844b699b2a25b01744cf78f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333048
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-11-01 18:04:19 +00:00
Stephen Adams 718f9076bd [tests] Make corelib/compare_to2_test work for web numbers
Change-Id: I98d13d92c486851630aa00f42ed981c1acf0ba53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333043
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-10-31 22:52:40 +00:00
Johnni Winther 72f1591f29 [cfe] Use getTypeAsInstanceOf instead of getInterfaceTypeAsInstanceOfClass
The changes calls to getInterfaceTypeAsInstanceOfClass (et al.) to
getTypeAsInstanceOf to ensure that we take extension types into account.

Change-Id: I7d732cdae8494002b44561cb02c49d58dd0ba67b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332920
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-10-31 22:30:50 +00:00
Ömer Sinan Ağacan 9ed368c2e1 [dart2wasm] Use only JS strings in JSCM
Refactor libraries so that JSCM will only use `JSStringImpl` class for
strings.

The goal is to disentangle the native string classes and `JSStringImpl`
and start testing `JSStringImpl` in isolation.

Changes:

- `dart:_string` is no longer available in JSCM.

- Make `int.toString` external to allow patching it differently in JSCM
  and normal modes.

  `toString` implementations are in `boxed_int_to_string.dart` patch
  files.

- `int.parse` now uses JS `parseInt`. However `parseInt` is not
  compatible with Dart's `int.parse` so this will cause some more test
  failures in JSCM for now.

- Any dependencies to `dart:_string` from JSCM `dart:convert` are
  removed. The library implementation now uses JS `TextDecoder` for
  UTF-8 decoding.

  Note: `TextDecoder` is not available on d8, so text decoding tests
  will fail on d8.

  JSON encoding and decoding in `dart:convert` will be updated in a
  follow-up CL.

- Compiler (translator, constant generator, code generator etc.) is
  updated to allocate the `JSStringImpl`s in JSCM.

Initially this will make some JSCM test fail as `int` parsing is not
quite right, those will be fixed in follow-up CLs.

Co-authored-by: Joshua Litt <joshualitt@google.com>
Change-Id: I366e06f44cdc369d28fe47b24015234260304399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-31 12:58:26 +00:00
Daco Harkes acad65713c [vm] Mark NativeFieldWrapperClasses as base
TEST=build SDK (modified patch files)
TEST=tests/ffi/*
TEST=runtime/vm/*_test.cc
TEST=runtime/tests/vm/dart/*

Closes: https://github.com/dart-lang/sdk/issues/51896
CoreLibraryReviewExempt: VM only.
Change-Id: I349849001adf8f3a62f3d4f94d4bdd295c36ef4d
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,vm-aot-linux-debug-x64c-try,vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291761
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-10-31 10:23:12 +00:00
Daco Harkes b1525cef56 [ffi/test] Expect crash in status file
Enables running tools/test.py ffi again.

Bug: https://github.com/dart-lang/sdk/issues/53829
Change-Id: I155bcd9a106ea7c48700dd6fb9d4fd97815837d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332762
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-10-31 09:39:25 +00:00
Aske Simon Christensen a212a47c82 Mark FutureOr toString test as requiring nnbd-strong
Closes https://github.com/dart-lang/sdk/issues/53738

Change-Id: I87849051ec2324eb03dbe86673dfa68402320454
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332424
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-10-31 08:26:45 +00:00
Sigmund Cherem e52de71408 [web] adjust transition test.
It is unclear if this will help reduce flakiness and timeouts. Until now
the test was setting the listener and making the transition on the same
microtask. If the transition were to complete before the listener is
fully set up, then that would explain the timeout: the transition event
is never fired at that point.  Honestly, I find this scenario hard to
believe, but regardless it is worth a try.

This small refactor changes the order to ensure the listener is set up
upfront, and only later we initiate the transition.

Change-Id: I3ae2bfae210ef307935c3d7f2aec9af82df1ddd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332625
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-10-31 00:50:11 +00:00
Sigmund Cherem c5baec83a5 [web] Skip mediadevices_test on firefox.
This test appears to flake 88% of the time in FF. One
potential reason could be that FF requires user interaction
(similar to the notification_permissions test), however
I don't have an explanation why it doesn't consistently time-out.

One potential theory is whether this behavior is different depending on
which FF browser version is used, but I don't have the data at the
moment to confirm.

Change-Id: Ib5b2759e0d289e44ff06ab11345c597af6cab0f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332626
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-10-31 00:05:26 +00:00
Paul Berry d8732e9820 When field promotion fails, report all reasons via context messages.
Previously, if field promotion failed both because the language
version was less than 3.2, *and* for some other reason(s), the
analyzer and CFE only reported the other reason(s). The rationale was
that this was better than reporting just that the language version was
less than 3.2, because if a user upgraded their language version to
3.2 in an attempt to get field promotion to work, and *then* found out
that the property in question was unpromotable for some other reason,
that could be quite frustrating.

With this change, if field promotion fails both because the language
version is less than 3.2 and for some other reason, the analyzer and
CFE report *all* the reasons.

Change-Id: Ib5d3a4621273c1e80d66b66b456119f9053e18b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332485
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-30 21:31:51 +00:00
Daco Harkes 59eb00e00d [test/ffi] Fix tests on Fuchsia
TEST=ffi/external_typed_data_finalizer_test
and others

Change-Id: Ic82e051ad5f551ceeecc0ff41efaa2bb9ee4914a
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332429
Reviewed-by: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-10-30 15:28:20 +00:00