Commit Graph

23777 Commits

Author SHA1 Message Date
Tess Strickland 81cb17ebca [io/win] Allow notFound stat errors in testDriveLetterNoBackslash.
Since the test uses existing system temp directory entries that
aren't created/maintained by the test itself, they may be removed
between the two calls to statSync().  Modify the test to allow for cases
where the first statSync() returns a non-notFound result and the second
returns a notFound result.

Also check that at least one iteration of the loop had a successful
result where the statSync() result is the same for both and was not a
notFound result, as all system temp entries retrieved by listSync()
being removed before one or both statSync() calls is highly unlikely.

TEST=standalone/io/file_windows_test

Fixes: https://github.com/dart-lang/sdk/issues/61007
Cq-Include-Trybots: luci.dart.try:vm-win-release-x64-try
Change-Id: If4bb4a6f6b1e21558e447e4e5a918523c69ff044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437442
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-06-27 05:52:10 -07:00
Jens Johansen e656fec1ee [CFE/Analyzer/parser] Fix crash upon double with separators and missing number after e
E.g. the user typing "1_234e" (and having yet to type a number) would
crash the analyzer.

Change-Id: Iff71c274a5e4719b3c8877ddbc9775d8d091c42f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-06-27 02:29:33 -07:00
Sergey G. Grekhov 2efecc91e9 [co19] Always run minified trybot
R=srujzs@google.com

Change-Id: Idad7be6b1df65239474111b418d58a3c6dceda43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437220
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2025-06-26 02:47:11 -07:00
Ryan Macnak b374d4265b Revert "[test_runner] Use relative paths in commands."
This reverts commit 1b4a56692b.

Reason for revert: breaks Fuchsia builders

Original change's description:
> [test_runner] Use relative paths in commands.
>
> This makes it easier to copy commands between checkouts or between the bot and local development.
>
> Change-Id: I74bc9dcb83855e295fe40fa4ef81871ccc537d29
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400180
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I8c7cca1e9c82a5b6e237d0b7611647a6168e6397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437123
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Ryan Macnak <rmacnak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-25 18:08:07 -07:00
Ryan Macnak 1b4a56692b [test_runner] Use relative paths in commands.
This makes it easier to copy commands between checkouts or between the bot and local development.

Change-Id: I74bc9dcb83855e295fe40fa4ef81871ccc537d29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400180
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-25 15:13:50 -07:00
Ivan Inozemtsev 0aa01cf395 Add pubspecs to Dart tests and scripts executed by checked in SDK
Without their own pubspecs, they belong to `_` project from the root
`pubspec.yaml`. As a result, once we bump the SDK version, these
scripts cannot be executed with the checked in sdk.

Note: when we bump the SDK version we also must bump the version in
the root pubspec, otherwise unreleased language experiments break.
Change-Id: Ie2ec35865a5966d6801de832a4b6ad312a24d277
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436901
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2025-06-25 08:00:10 -07:00
Martin Kustermann 931ec382d4 [io/gardening] Fix client address binding & fix standalone/io/socket_local_port_test
Various changes to the stanalone/io/socket_local_port_test:

  * Make server ports ephemeral: The test is testing client-side
    binding of address & port, the server part can use ephemeral ports.
    => This eliminates the issue of another process using the
       hard-coded port
  * Close sockets normally instead of using `Socket.destroy()`
  * Make dead code alive: There were test in the tests that were
    not invoked by `main()`.
  * Align the individual test helper functions.
  * ...

Then we change the dart:io implementation of `Socket::CreateBindConnect`
to set the `SO_REUSEADDR` socket option. We do this already for the
server side in `Socket::CreateBindListen`, now we do it also for the
client side.
=> This will ensure that one can bind the client side socket to
   specific address/source despite there being an old closed
   socket that's now in `TIME_WAIT` state.
=> This is the same reason we also do it in `Socket::CreateBindListen`.

Fuchsia doesn't implement `Socket::CreateBindConnect` and on Windows
the socket option seemingly has different semantics (we also don't use
`SO_REUSEADDR` on windows for the server socket, but another option).

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

TEST=standalone/io/socket_local_port_test

Change-Id: I7d07becad0cd98c3a9b973ef2f9037730d3f8b19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436902
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-06-25 02:56:21 -07:00
Martin Kustermann fecf1b0750 [gardening] Fix standalone/io/named_pipe_operations_test
The test was writing a dart script and then invoking a
subprocess to run that script.

=> The write of the script was asynchronous but not awaited
=> The subprocess can start running before the script is written

We also cleanup the test, it seemingly has some copy&pasted code
from another test that isn't relevant (it doesn't write
anything to the subprocess's `stdin` channel, ...)

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

Change-Id: Iaa1094056cf444a976b2edc373227e54868fae94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436900
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-25 02:04:36 -07:00
Ryan Macnak 42d796f7c1 [dart:io, mac] Don't create a thread pool per secure socket.
TEST=ci
Bug: https://github.com/flutter/flutter/issues/170723
Change-Id: I381c0dac8f7e308830c8bba472e11fb20939708e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436501
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-24 12:17:24 -07:00
Nate Biggs 886624cbf9 [dart2js] Add helper to detect csp in web tests and use it to set expectations for some tests.
Fixes these: https://dart-ci.firebaseapp.com/#showLatestFailures=true&configurations=dart2js-minified-csp-linux-chrome

Change-Id: I2939e3ce1fdee45d570d038f2f4382747cd617dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436140
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-06-24 12:06:22 -07:00
Martin Kustermann 320cc28d63 [tests] Remove unnecessary status file suppressions for tests
Change-Id: Ide81ada6931575da049d2ef3e88c9426b7e25ee4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436243
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-24 01:26:33 -07:00
Martin Kustermann 76548a7ab9 [tests] Rewrite various tests to not depend on <obj>.runtimeType.toString()
In dart2wasm applications are by default deployed in `-O2` mode which
implies `--minify`.

Given this is the default configuration for customers, we want good
testing of this configuration and not large numbers of approved failures.

=> Rewrite various tests to not depend on `<obj>.runtimeType.toString()`

Change-Id: I1108b28c63b8bec6ad94df0d7b878b3339776df9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436281
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-24 01:16:24 -07:00
asiva a7894ad933 Turn on SSL tests on Android.
TEST=ci

Change-Id: I7580ca079109c0d79fd8dc5b4c7e8dc47b6500a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-06-21 10:15:12 -07:00
Nate Biggs d3539374ff Cleanup extra --strong flags being passed in test/web.
Change-Id: Ia00ced1c31ccd49dc883d4dfdc4fe644d8a5e363
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435600
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-06-20 20:11:25 -07:00
Nate Biggs 124b98b461 [dart2js] Move tests from tests/web that are failing on DDC configurations into dart2js specific folder.
Also update dart2jsOptions on some tests that are failing on production/O0 configurations.

Change-Id: Ie0a8fa56dc391c98186f1573a76cff7ef6afde8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433563
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-06-20 20:11:25 -07:00
MarkZ 2b1cbb0c88 [ddc] Adding test for cross module private symbols as function default values.
Change-Id: I54e29a3883b2e444945574d3d5e03f741c1e8716
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436020
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-06-20 14:40:47 -07:00
Stephen Adams 3f5314fb2f Reapply "[dart2js,rti] Add direct methods for as JSObject"
This reverts commit 43b5c1432e.

This time, fall back on code that works for mocks and fakes.

Issue: #60746

Change-Id: Iecb822486729f8b10377c94bf87d06406bb0f5bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434920
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-06-18 19:21:22 -07:00
Johnni Winther b8b072ed3b [cfe] Update message for undefined access
This updates the message text for undefined access. Instead of saying
that the member is not defined on the "class", it now says on the "type".

Closes #60290

Change-Id: I9387f892e99ba109b9b1d99af25714ab83b5350c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433941
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-06-17 04:03:26 -07:00
Ryan Macnak ab4f9351b1 Rename vm_platform_strong.dill to vm_platform.dill.
The name has always been annoying because it did not add strong typing. And now there aren't variants of the VM platform to distinguish.

Leave a copy at the old name to not immediately break illegal uses.

TEST=ci
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,flutter-frontend-try,flutter-linux-try
Change-Id: Ie76fa7f16940aa1ba8d582eb5197f0ae55dc8938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429828
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-16 18:33:38 -07:00
asiva 6575655850 Remove some tests which were marked flaky.
Change-Id: Ibd0d153b994dbeaada4d55242ed529f20465362c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434780
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-06-13 19:10:41 -07:00
Lasse R.H. Nielsen 007033109d Only mark tests non-text if they actually depend on line ending.
Some test files were included, where only their data actually
depended on line endings.

Some tests didn't actually depend on line ending at all.
(They may date back to a time where multiline strings didn't
normalize their newlines.)

Fix some syntax tests that had been formatted, and exempt
all files depending on line endings from formatting.

Change-Id: I6c003e9c4f03d3b2af102bfca59d4a7bc8e6d63f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434380
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-06-13 16:16:13 -07:00
Paul Berry 5e3c017d05 [cfe] Fix inference order for local function parameters with defaults.
When a function expression has a parameter that:
- is optional,
- has an explicitly specified default value, and
- has an inferred type,

it's important that the type of the parameter be inferred before
recursively visiting the default value. Otherwise, the default value
will receive the wrong type inference context, and the default value
won't be type checked (which can lead to unsound behavior).

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

Bug: https://github.com/dart-lang/sdk/issues/60908
Change-Id: I866468599c244c6117c05d86ce23bc0e9031aa9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434123
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-13 07:37:02 -07:00
Nate Biggs 31dc969da2 [ddc] Test DartPad-like hot reload workflow.
Refactors the hot reload test suite to support non-FE server based hot reload. Similar to DartPad it uses a DDC process running in '--persistent_worker' mode and sends bazel requests for each reload.

I call this "stateless" mode because the compilation process itself is not maintaining any state. The necessary metadata is passed from one compilation to the other via a delta dill. This differs from the "stateful" mode where the FE server persists a kernel AST in memory from one compilation to the next.

Disregarding the browsers there are effectively 3 run modes now:
- web stateful
- web stateless (new)
- vm stateful

One key difference between the "stateless" and "stateful" modes is the output format of the JS files. In stateful mode DDC emits a file per library being re-compiled. In stateless mode DDC is emitting a single file with all the libraries.

DartPad's workflow is slightly simpler than what's seen in the stateless mode here. It only supports editing a single library so we skip processing any metadata. To simulate this I've added the special 'main_only' which passes a single library for each reload generation. I've verified that this would fail if not for the change recently made to ddc_module_loader.js.

Change-Id: If05da6dbeded4dd20e9e6d9dfaed52151541a19b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434340
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-06-12 17:18:30 -07:00
Paul Berry f4e6182278 [flow analysis] Address style comments from recent code reviews.
This CL addresses style comments from Lasse on
https://dart-review.googlesource.com/c/sdk/+/429227 and
https://dart-review.googlesource.com/c/sdk/+/431740.

Change-Id: I87add7fc6179e186545aef7eda3a7a1e43c48c01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433265
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-06-10 00:46:35 -07:00
Alexander Aprelev 4715ebd181 [vm/shared] Update mutator count as entering/exiting mutator thread.
Running dart code on mutator thread outside of isolate still should follow limits on number of concurrent mutators in the vm.
Also this fixes inconsistency when entering isolate group as mutator, where original worker was marked as blocked while thread was actually running dart code. That inconsitency showed up as sporadic crash on isolate_group_shared_init_test with increased number of spawned isolates.

TEST=isolate_group_shared_init_test
BUG=https://github.com/dart-lang/sdk/issues/60877

Change-Id: I8917be903bb5517940dad3e5dab143d5ed5fdf79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-06-09 10:34:40 -07:00
Ivan Inozemtsev 15c58a889f Add static variants of Dart engine library and update samples
Fixes https://github.com/dart-lang/sdk/issues/60799

Change-Id: I16a8dd2c854ed6915f14e1b71547879f50f2de0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432920
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2025-06-06 04:00:45 -07:00
Alexander Aprelev ef4e39a6ef [vm/shared] Ensure exclusive execution of shared field initialization.
Add a mutex to guard execution of vm:shared field initialization.

TEST=isolate_group_shared_init_test
BUG=dartbug.com/60699

Change-Id: If544351fc26bfcc7fb9703954efe785989d488bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431742
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-06-05 14:12:33 -07:00
Brian Quinlan 0ac78fb92f [io] Fix a bug where the proxy configuration parser did not correctly validate proxy passwords.
Closes https://github.com/dart-lang/sdk/pull/60476

GitOrigin-RevId: c2f3b31db38755c7d439daa862e86c528744739c
Change-Id: I498dcfae0b0c9614fc388f102f8d88630e0761ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420381
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2025-06-05 13:52:34 -07:00
Daco Harkes 47cc2606f4 [ffi/test] Address lints
Change-Id: I3b13731935c8520b8ca17ee45d967499fccdcbe9
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432940
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-06-04 07:53:51 -07:00
Paul Berry eec56c088e [flow analysis] Mark false branches of trivial is tests unreachable.
When an `is` test is trivially satisfied (i.e. `expr is T`, when the
static type of `expr` is a subtype of `T`), the `is` test is
guaranteed by soundness to evaluate to `true`, so any code path that
follows from the `is` test evaluating to `false` is unreachable.

This reasoning wasn't valid prior to sound null safety, because in
mixed mode programs, it was possible for an expression to evaluate to
`null` even if its static type wasn't nullable, and hence `expr is T`
might evaluate to `false` even if the static type of `expr` was a
subtype of `T`. So this change is gated on the `sound-flow-analysis`
language flag (which is enabled in Dart 3.9).

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

Change-Id: I66a65580b738162f23b6fb468b71fcac66bfbb95
Bug: https://github.com/dart-lang/sdk/issues/60718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431740
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-04 05:17:21 -07:00
Paul Berry 9602464304 [flow analysis] Don't clear types of interest on full demotion.
Previously, when assiging to a local variable that was promoted, if
the newly assigned value was not compatible with any of the promotions
(i.e., the variable was fully demoted back to its declared type), then
the set of types of interest was cleared.

This behavior was not documented anywhere in the spec, and it seems
oddly inconsistent to me; as far as I can tell, flow analysis doesn't
clear types of interest in any other circumstances. I've looked
through git history as well as my personal notes, and I've been unable
to find any justification for this behavior. So, with the agreement of
the language team, I'm removing it when sound-flow-analysis is
enabled.

Fixes https://github.com/dart-lang/language/issues/4380.

Bug: https://github.com/dart-lang/language/issues/4380
Change-Id: Ic1ca80a61e21482e659afa8796b08fce707db3c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429227
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-03 14:19:53 -07:00
Tess Strickland f8e21c5c94 [pkg/test_runner] Only use .dll for assembled snapshots on Windows.
Use "out.aotsnapshot" as the name for all non-assembled snapshots and
names with the appropriate shared object extension for the host OS for
assembled snapshots.

This ensures the test checks for .dll extensions added in
https://dart-review.googlesource.com/c/sdk/+/428200 only trigger
for assembled snapshots as expected, and not for other formats
(e.g., Windows trybots using sanitizers, which still use direct
to ELF snapshots).

Also fixes incorrect line numbers in dwarf_stack_trace_test.dart.

TEST=vm/dart/build_id_test
     standalone/dwarf_stack_trace_test

Cq-Include-Trybots: luci.dart.try:vm-asan-win-release-x64-try,vm-linux-release-x64-try,vm-mac-release-arm64-try
Bug: https://github.com/dart-lang/sdk/issues/60846
Change-Id: Ife06613d86874d76adeb99dcbc50fc3723aae584
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432660
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-06-03 06:23:04 -07:00
Tess Strickland f7699740cc [vm] Allow manual loading of Mach-O dynamic library snapshots.
Adds a Mach-O loader, similar to the existing ELF loader, that
can be used on platforms that do not support loading Mach-O dynamic
libraries via dlopen().

Other changes:

* Renames the --force-load-elf-from-memory command line argument
  to --force-load-from-memory.
* Use CPU_TYPE_ANY and CPU_SUBTYPE_ANY for architectures that do
  not have specific constants in <mach/machine.h> (e.g., RISCV),
  as the snapshot header check after loading also catches architecture
  mismatches.
* Emit the unwinding information at the end of the text segment
  for Windows Mach-O snapshots as is done for ELF ones.

TEST=vm/dart/unobfuscated_static_symbols_test
     vm/dart/use_dwarf_stack_traces_flag_test

Issue: https://github.com/dart-lang/sdk/issues/60307
Change-Id: I34a2a334f47d18d5c4f4a712956e71fd0ac94024
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-mac-release-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-fuchsia-release-x64-try,vm-fuchsia-release-arm64-try,vm-linux-debug-ia32-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-release-simarm_x64-try,vm-gcc-linux-try,vm-ubsan-linux-release-arm64-try,vm-aot-win-release-arm64-try,vm-aot-win-release-x64-try,vm-win-release-x64-try,vm-win-release-arm64-try,vm-aot-win-debug-arm64-try,vm-win-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430100
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-03 05:56:59 -07:00
Paul Berry 9f0e5229fa [flow analysis] Fix layering of type promotions in try/finally.
A tricky part of the implementation of flow analysis is the handling
of try/finally statements. Although promotions are tracked separately
in the `try` and `finally` blocks, promotions from both blocks need to
be merged together at the conclusion of the finally block. This
creates an ambiguity, because each type in a promotion chain is
required to be a subtype of the previous, and hence multiple
promotions of the same variable are inherently ordered. The ambiguity
is: when the promotions from the `try` and `finally` block are merged,
which promotions should be applied first?

In discussion with the language team, we've decided that the
promotions from the `try` block should be applied first, because that
matches the order of code execution. This change makes the behavior of
flow analysis more uniform, which should make it easier to reason
about and maintain.

In practice, the difference in behavior is quite subtle, and I don't
expect users to notice. However, to be on the safe side, the change in
behavior is conditioned on the `sound-flow-analysis` flag, so it will
only take effect when the user deliberately upgrades to language
version 3.9, and it will not affect already-published packages.

A test in google3 showed that no internal code would be broken by
force-enabling this change.

Fixes https://github.com/dart-lang/language/issues/4382.

Change-Id: I0e9f6db808a964e0b4325d3020654a9f2be273a2
Bug: https://github.com/dart-lang/language/issues/4382
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432001
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-02 13:57:11 -07:00
Ryan Macnak 03301c9bfb [vm] Support assembly output for Windows.
The resulting DLL lacks debugging information / PDB.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/60812
Bug: https://github.com/dart-lang/sdk/issues/60813
Cq-Include-Trybots: luci.dart.try:vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-release-arm64-try,vm-aot-win-release-x64-try
Change-Id: I305bad0081ec24f27249ad9b75ff8d32fa9c4893
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428200
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-02 12:12:04 -07:00
Alexander Aprelev 86341c9b8a [vm/gardening] Skip isolate_group_shared_send_test on fuchsia.
The test requires --experimental-shared-data flag, passing of flags is not supported for fuchsia testing.

Fixes failures https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8713156044238231937/+/u/test_results/new_test_failures__logs_

Change-Id: I534dd24325e79f44e882f7ab35f78be1f959c925
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432324
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-06-02 11:43:57 -07:00
Ryan Macnak 56636971dc [test_runner] Remove nnbd mode options.
In particular, this means the VM tests stop getting invoked with the now-invalid --sound-null-safety flag.

Change-Id: Ia8f5a59e0bf1fd7094508fdc4bb146ebf3034148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431360
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-02 10:59:31 -07:00
Paul Berry bf6ddd25c4 [flow analysis] Do not promote to mutual subtypes.
Previously, flow analysis had the rule that type promotion only
occurred when the type being tested was a subtype of the previously
promoted type (or the declared type, if there was no previous
promotion). This led to counterintuitive behaviors when the type being
tested and the previously promoted type were mutual subtypes (see
https://github.com/dart-lang/language/issues/4368).

With this change, the rule is updated so that type promotion only
occurs when the type being tested is a subtype of the previously
promoted type _and_ the previously promoted type is _not_ a subtype of
the type being tested. The user-visible difference is that promotion
to a mutual subtype no longer occurs.

This change makes flow analysis easier to reason about, and improves
its behavior in corner cases, but I believe it will have minimal
impact on real-world code. But to reduce the risk to existing code,
the change only takes effect when the `sound-flow-analysis` language
feature is enabled.

Fixes https://github.com/dart-lang/language/issues/4368.

Bug: https://github.com/dart-lang/language/issues/4368
Change-Id: I30dab017e043e75603d618df721c8a2683667cd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-02 10:27:03 -07:00
Alexander Aprelev 65d0d8581a [vm/shared] Move forward_table from Isolate to Thread.
Having forwarding tables on the Thread allows for those tables to be used in dart mutator thread running in IsolateGroup-shared context. On 32-bit platforms(arm) the forwarding tables are used during [SendPort.send] message verification.

Fixes https://github.com/dart-lang/sdk/issues/60817
TEST=isolate_group_shared_send_test

Change-Id: I58b33c14026584330b594776e812fe1d48bc2fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-06-02 10:04:39 -07:00
Sergey G. Grekhov df126594e9 [co19] Roll co19 to 3388e8e9073d57e6fdca6582568fdfa6f9a6bc61
2025-06-02 sgrekhov22@gmail.com dart-lang/co19#3180. Add tests for NullableUndefineableJSAnyExtension. (dart-lang/co19#3205)
2025-06-02 sgrekhov22@gmail.com Fixes dart-lang/co19#3212. Fix the new roll failures. Add issue numbers (dart-lang/co19#3213)
2025-06-02 sgrekhov22@gmail.com dart-lang/co19#3057. Update promotion_switch_A05_t03.dart according to the current implementation (dart-lang/co19#3214)
2025-05-28 sgrekhov22@gmail.com Fixes dart-lang/co19#3201. Allow getter/setter with different types (dart-lang/co19#3207)
2025-05-28 sgrekhov22@gmail.com Fixes dart-lang/co19#3206. Update expected errors positions for CFE (dart-lang/co19#3208)
2025-05-27 sgrekhov22@gmail.com dart-lang/co19#2868. Add test for a member invocation of an extension on nullable type (dart-lang/co19#3204)
2025-05-26 sgrekhov22@gmail.com dart-lang/co19#3057. Add more tests for promotion in switch (dart-lang/co19#3185)
2025-05-26 sgrekhov22@gmail.com dart-lang/co19#3057. Add switch statements/expressions patterns matching tests (dart-lang/co19#3169)
2025-05-23 sgrekhov22@gmail.com dart-lang/co19#3198. Remove accidental code (dart-lang/co19#3202)
2025-05-23 sgrekhov22@gmail.com Fixes dart-lang/co19#3198. Don't use string representation of `Type` objects (dart-lang/co19#3200)
2025-05-23 sgrekhov22@gmail.com dart-lang/co19#3182. Update augmenting_declarations_A05_*.dart (dart-lang/co19#3199)

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Change-Id: I89444579e87815f0087ac538bb2ea264f93d2180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432280
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2025-06-02 09:06:52 -07:00
Ryan Macnak 2565128cb0 [infra] Shard Mac AOT builders.
Use a combination of gen_snapshot's new ability to generate dylibs directly and the copy of llvm in buildtools to avoid using XCode, which is not available in shards.

Add definitions for debug builders now that they can complete without timing out.

Cq-Include-Trybots: luci.dart.try:vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try
Change-Id: I79924128f11aafab4cd74ea6e9ab5848c64557da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431700
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-02 08:21:35 -07:00
Alexander Markov c006202dc6 [vm,dyn_modules] Convert function type args to instance type args when allocating an object in constructor tear-off
TEST=tests/language/regress/regress60816_test.dart
Fixes https://github.com/dart-lang/sdk/issues/60816

Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Change-Id: Id4c9ae3dc14cf680ba5f04d54d019ebe589ad96d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432100
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-02 07:30:58 -07:00
Stephen Adams d49cd3c552 [dart2js] Track, rather than compute, isCallOnInterceptor
By tracking `isCallOnInterceptor`, we avoid the need for class context
information in the `sourceElement` to compute the value. `sourceElement`
is now purely advisory to the choice of local names in codegen, and
can't be the wrong kind of element as in issue #60793.

Bug: #60793
Change-Id: I8bb68b6bf864a3a6f9f2beb40f68a6254431d49a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432003
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-05-30 11:38:22 -07:00
Johnni Winther ac2fc57446 [cfe] Combine getter/setter and final field/setter into one property builder
This combines getter/setter and final field/setter pairs into a single
SourcePropertyBuilder. This prepares for handling augmentation of
properties.

Change-Id: Ie2d9b89baa1ae72e53d7d09d672d2aa2327ef7ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431100
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-05-28 00:38:32 -07:00
Kallen Tu 89552236ff [analyzer] Dot shorthands: Infer type parameters in constructor tearoffs.
This CL fixes co19/LanguageFeatures/Static-access-shorthand
/semantics_A05_t01.dart.

While working on this, I realized the static type was wrong and we weren't doing any inference for the constructor references so I updated the logic.

Unit tests passing, language test expectations are actually better than before and that particular co19 test passing.

Bug: https://github.com/dart-lang/sdk/issues/59835
Change-Id: I7437079c33640f53f48a4445890fadfebc9ec158
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430561
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-05-27 11:44:00 -07:00
Chloe Stefantsova 6fa858cfe8 Enable 'getter-setter-error' flag in 3.9
TEST=existing

Change-Id: Ic4a5735adda7cf8ef1565b9356ca277d9b62b064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430720
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2025-05-26 08:08:31 -07:00
Alexander Aprelev 0f34fdde1d [gardening] Skip isolate_group_shared_callback_test on hot reload bots.
The test in reload is very slow in "--shared_slow_path_triggers_gc" configuration.

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

Change-Id: I16e9ff1de273464a866db6db8fa839b7aa03dca8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430882
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-05-23 11:14:31 -07:00
Alexander Aprelev 6497b412e2 [vm/shared] Ensure dart mutator thread stack is walked during gc.
Fix asynchronous aspect of the test.

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

Change-Id: Ife311d5663665e7fa6e8dd3977fc31f5ed22cc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430580
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2025-05-23 07:23:22 -07:00
Martin Kustermann 226a667ef9 [dart2wasm] Add const bool.fromEnvironment('dart.tool.dart2wasm.minify')
We add the `dart.tool.dart2wasm.minify` environment define (analogous to
how dart2js exposes `dart.tool.dart2js.minify`).

We make `package:expect/variations.dart` then expose to tests what
guarantees they can assume, namely

   * `readableTypeStrings`
   * `preciseErrorsWithDetails`

Change-Id: I43da09ed924ca9137721f4d70b7a494e01bf36e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430680
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-05-23 01:26:38 -07:00
Nicholas Shahan f4c87f2ae8 [ddc] Add hot reload checks to instance getter accesses
Checks the compile and current hot reload generations. If they are not
equal the value is checked to have a getter of the expected name and
if so it gets called. If not, `.noSuchMethod` is invoked instead.

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

Change-Id: Ib80582b45f87f2ab41b943e0f263167b38601e0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429066
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-05-22 13:27:31 -07:00