Commit Graph

113570 Commits

Author SHA1 Message Date
Danny Tuppeny f1ceed2ba7 [analysis_server] Add command/resolve to support using Interactive Forms in refactors
This adds support for the `command/resolve` request to support the new Interactive Forms functionality, and updates the refactor processes to use it instead of the original protocol when the client indicates support.

Currently only the "Move to File" refactor uses this functionality (matching the previous version) and it requires the `dart.experimentalInteractiveForms` setting be enabled for it to be used (in case we find bugs while developing the front-end that require incompatible changes).

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

Change-Id: I414a41fa2958ca9dcefe097f35ba28f3fa2fe367
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508121
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-03 08:47:33 -07:00
Paul Berry 189f25b873 [front_end] Update CFE code generators to use new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change makes the code generators in the front_end package emit
code that uses the new constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This avoids the need for `ignore_for_file:` comments and gives us a
bit more testing of the new feature.

Change-Id: Ica5c13018a286cd274dba2cf946304446a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-06-03 07:27:41 -07:00
Jens Johansen 7cc5515a6a [vm] Mark _OperatorEqualsAndHashCode._hashCode for inlining
In a valgrind "profile" of a run of an aot-compiled version of
`pkg/analyzer/tool/stable_analysis.dart` I noticed that
`_OperatorEqualsAndHashCode._hashCode` was called 40,288,281 times,
costing - by itself, i.e. without the actual cost of getting the
underlying hashCode - 723,483,274 instructions - about 1.79% of the
total cost.

Interestingly `_OperatorEqualsAndHashCode._equals` wasn't there, so that
one must be inlined (whereas the `_hashCode` isn't). Stepping via GDB
confirms both things.

Via the inlining tracing in the vm via

```
out/ReleaseX64/dart-sdk/bin/dart \
compile aot-snapshot --verbose \
--extra-gen-snapshot-options="--print_inlining_tree" \
pkg/analyzer/tool/stable_analysis.dart
```

I found

```
Inlining into: 'dart:_compact_hash___Map&_LinkedHashBase&MapMixin&_HashBase&_OperatorEqualsAndHashCode&_LinkedHashMapMixin@3099033_[]='
    growth: 0.000000 (9 -> 0)
  NO 14 __Map&_LinkedHashBase&MapMixin&_HashBase&_OperatorEqualsAndHashCode@3099033._hashCode@3099033 - Heuristic fail (no small leaf)
  NO 16 __Map&_LinkedHashBase&MapMixin&_HashBase&_OperatorEqualsAndHashCode&_LinkedHashMapMixin@3099033._set@3099033 - Not inlinable
```

In `runtime/vm/compiler/backend/inliner.cc` I saw that I could avoid
this "no small leaf" thing by marking it for inlining.

Running stable_analysis through `perf stat` without and with this CL I
get:

```
Without CL:
    39,552,232,456      instructions:u
    39,552,392,619      instructions:u
    39,554,905,123      instructions:u
```

```
With this CL:
    39,024,836,004      instructions:u
    39,022,158,372      instructions:u
    39,022,782,198      instructions:u
```

So this "only" saves something like 527 million instructions (~1.3%),
i.e. less than the ~723 million instructions hoped for, but I'll take
it.

Change-Id: I07a8fb097e46ab48c26bcf7896b12c7312ededc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509000
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-06-03 07:11:18 -07:00
Nourhan Hasan 80f770eb57 [vm/service]: Add _readNativeMemory RPC and OS::SafeReadMemory for safe native memory inspection
- Declare OS::SafeReadMemory in os.h
- Implement using pread64(/proc/self/mem) on Linux and Android
- Add _readNativeMemory VM Service RPC with pre-checks for null
  and address overflow

TEST=runtime/vm/service_test.cc

Cq-Include-Trybots: dart/try:vm-asan-linux-release-x64-try,vm-asan-mac-release-arm64-try,vm-asan-win-release-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-arm64-try,vm-linux-debug-ia32-try,vm-linux-debug-simriscv32-try,vm-linux-debug-simriscv64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-simarm-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-tsan-linux-release-x64-try,vm-tsan-mac-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-ubsan-mac-release-arm64-try,vm-ubsan-win-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try
Change-Id: Id15a82bf478bc4822c08d7fdf0a5c8bfd71a1fe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505781
Auto-Submit: Nourhan Hasan <nourhan.m.hasan@gmail.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2026-06-02 23:09:24 -07:00
Ryan Macnak 1b3e9d510e Fix Fuchsia build.
Don't need to maintain testonly for the main Fuchsia tree anymore.

TEST=gn
Change-Id: I99c513dac5aa09ef47a6b6666c934ad63fe4a874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508823
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-06-02 16:47:34 -07:00
Ryan Macnak 152d83492f Reduce GCC build set.
runtime is not a proper subset of create_sdk.

Change-Id: Ieb393029481475e866daf4eb2aa3280045c17d3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508703
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-02 16:32:29 -07:00
Srujan Gaddam dd60262f06 [DEPS] Update Chrome and jsshell
Change-Id: Ie72b337bb0896ebe73a9520e40b90401da235108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508820
Reviewed-by: Nate Biggs <natebiggs@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-06-02 15:38:03 -07:00
Sam Rawlins 23ad0dc770 linter: Deprecate avoid_public_typedef_functions and one_member_abstracts
Work towards https://github.com/dart-lang/sdk/issues/59524

* avoid_private_typedef_functions - Doesn’t meet any sufficient
  criteria? I think a private typedef can certainly make local code
  more readable.
* one_member_abstracts - Low impact. This is maybe here for Java
  developers? It encourages users to use top-level functions.

Change-Id: I829acda8af0bc2bb265553e1297cd1740761b4da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 15:08:43 -07:00
FMorschel ab017d3bda [linter, DAS] Adds new diagnostic opposite of unnecessary_await_in_return
Bug: https://github.com/dart-lang/sdk/issues/62555
Change-Id: Ica84ea93efcb2c74d2fd260cdceebbf6558e7bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477660
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: FMorschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 15:06:00 -07:00
Ryan Macnak 0ae45fcc7e Reduce Android build set.
Change-Id: I810fd52726eb177e91b1425644373e52c4d871c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508500
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-02 14:46:08 -07:00
Paul Berry 95b1b8d756 [front_end] Migrate to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the front_end package to use the new
constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) enabling the
lints `unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (b) fixing the resulting lint
failures using `dart fix`, and then (c) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Change-Id: I6b48c0f1c762c3fa132fbd79382496ca6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508368
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-06-02 13:34:17 -07:00
Ben Konyi 0e535e710b [vm_service] Fix socket exhaustion in resume_shutdown_race_test
The resumer in `resume_shutdown_race_test.dart` was running in a tight
`do-while` loop, hammering the VM server with `getVM` and `getIsolate`
requests to check if all isolates are paused at exit. During VM
shutdown, this rapid sequence of requests could cause socket exhaustion,
especially on Windows, or trigger transient connection errors.

This is fixed by adding a 10ms delay using `Future.delayed` at the end
of each iteration, and wrapping the loop's HTTP request block in a
`try-catch` block to gracefully log and ignore transient connection or
request errors during VM shutdown.

Change-Id: I1bfcad7505254a1feb59dfb654421547efc02d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508720
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2026-06-02 13:22:38 -07:00
Martin Kustermann 3f7dd5c075 [dart2wasm] Do not use CFE lowering for constructor tear-offs
The CFE constructor tear-off lowerings introduce extra static methods.
Tear-off constants refer to them as `StaticTearOffConstant`s. They
just forward the call to the actual generative, factory or
redirecting factory constructors.

We can avoid these intermediary methods by not using the CFE lowerings.

Change-Id: I1dc1203d6b3023cf1f13bc204a2628ec8a3aebc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508562
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-06-02 13:21:23 -07:00
Brian Wilkerson a75be76daf Fix bug in convertIntoBlockBody
I ran across this bug while testing to see what work was already done.
I didn't take the time to create an issue.

The bug is that an assist was being offered for `class C ^{}` to
convert the class body into a block. The result, for an empty block,
was just to add an extra space before the block body. For a non-empty
block, the result was to delete everything inside the block.

Change-Id: I0342b681ef67b5e659a00126a998d63d593223fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508702
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-02 13:04:55 -07:00
Ben Konyi 3c0e8ac2fb [vm_service] Fix http_auth_get_isolate_rpc_test not actually testing with authentication codes
When `useAuthToken` is true, the VM Service URI includes the
authentication token as a path segment (e.g.,
`ws://127.0.0.1:8181/auth_token/ws`). Previously,
`http_get_isolate_rpc_common.dart` converted `service.wsUri` to an HTTP
`serverUri` by only copying the host and authority, stripping out the
auth token path segments. This caused all subsequent HTTP request
helpers to fail with a missing or invalid authentication code error.

This is resolved by:
1. Enabling `useAuthToken: true` in `http_auth_get_isolate_rpc_test.dart`.
2. Updating
`http_get_isolate_rpc_common.dart` to extract and preserve the path
   segments from `service.wsUri` (excluding the trailing `'ws'` segment) and
   ensuring a trailing empty segment so that `buildRequestUri` correctly
   formats the final HTTP request path.

Change-Id: I773d402af05c451d2ed776a9660c0bc04f4c672c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508381
Commit-Queue: Mark Zhou <markzipan@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2026-06-02 12:51:23 -07:00
Ben Konyi ab6780d13e [dds][dart_runtime_service] Dynamically allocate ChromeDriver ports and fix SSE test flakiness
This change addresses flakiness in SSE tests caused by port conflicts
and race conditions during connection teardown.

Key changes:
- Dynamically allocates ChromeDriver ports in `sse_smoke_test.dart` and `sse_client_test.dart` instead of using a hardcoded port (4444). This avoids conflicts when tests run in parallel on CI bots.
- Adds support for locating ChromeDriver via the `CHROMEDRIVER_PATH` environment variable in both test suites.
- Updates `sse_smoke_driver.dart` to introduce a brief delay before closing connections. This ensures the client-side SseClient has sufficient time to flush its final POST request to the server, avoiding "Bad state: No element" errors.
- Modifies `test_helper.dart` to filter out `--mark_main_isolate_as_system_isolate` from arguments forwarded to spawned testee processes. This is necessary under modern `dart test` runners to ensure processes pause at start as expected.

Change-Id: Idf45cd69f366ec6b6f81cfed955aea337b277dcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508343
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2026-06-02 12:46:31 -07:00
Konstantin Shcheglov d8fab3228b Augment. Support for function-typed formal parameters in augmentations.
Change-Id: I665810aaeeb96dceb0045c98d426493a0fc75892
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507960
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 12:24:36 -07:00
Ben Konyi 2b4ba49f0d [vm_service] Fix socket leak in makeHttpServiceRequest
In `http_request_helpers.dart`, `makeHttpServiceRequest` was not closing
the created `HttpClient` instance if an exception was thrown during the
HTTP request, response parsing, or JSON decoding. This could cause
socket leaks in tests that invoke this helper.

This is resolved by wrapping the HTTP request, response, and parsing
logic inside a `try-finally` block, ensuring that `httpClient.close()`
is always executed.

Change-Id: I40d5fb8d2c2cd9c16d83418e71a7dc0d67ef2cdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508740
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2026-06-02 12:23:10 -07:00
Konstantin Shcheglov 73d499369a Augment. Report defaultValueAlreadySpecifiedInAugmentationChain.
Change-Id: I0e12de28aea3f767bcd6e5f36a61c544c69e102b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507880
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 12:12:20 -07:00
Konstantin Shcheglov 54ea451b36 CQ. Migrate more tests from parseStringWithErrors() to parseTestCodeWithDiagnostics().
Change-Id: Ifa7b7302fb6c059cf628f06d519f8391b510427c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508370
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 12:08:10 -07:00
Konstantin Shcheglov 33d4f1dff7 CQ. Migrate ToSourceVisitorTest from parseStringWithErrors() to parseTestCodeWithDiagnostics()
Change-Id: I902b4162f68acb2c220a2ee8c4ab8bcc47e3a3f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508423
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 12:03:14 -07:00
Konstantin Shcheglov 68b3e3c9a0 Augment. Remove a few 'abstract' modifiers from classes.
These were previously added because the parser did not support
abstract fields without diagnostics, IIRC.

Change-Id: Iba654bbfba3828e9823a65cc2b28f11a9ae0144a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 11:58:59 -07:00
Konstantin Shcheglov 856afa7248 CQ. Fix superclassName value for constConstructorWithNonConstSuper.
Change-Id: Ib90558dfabf72b2a3743dc06b6bc4886eb65fbba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508442
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 11:57:55 -07:00
Konstantin Shcheglov 2cc79a0fec Augment. Report modifierOutOfOrder for 'abstract static' field.
Change-Id: I6e25f204708ed6031e4004464205b5b173253e81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508373
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 11:55:23 -07:00
kevmoo 45c27304eb Bump tools to 338a2c8380059afb250a1d0c26555e4da24c6ccc
Also removed SDK-version of api_summary.

Migrates the `api_summary` package from the SDK (`pkg/api_summary`)
to the `tools` monorepo (`third_party/pkg/tools/pkgs/api_summary`).

Updates SDK workspaces and dependency overrides in `pubspec.yaml`
and unit tests in `tools/bots/test_matrix.json`.

The API summary when through a review when landed in tools and includes additional changes. See https://github.com/dart-lang/tools/pull/2412/commits

The changes to `api.txt` files are due to this bug fix:
https://github.com/dart-lang/tools/pull/2412/changes/1fcb09f9466740e21b93a1b082d2bd4cc9ded9c7#diff-ee68240679409574825ff54e43ecf132ff6eb7214844aabeb88b576944f4d5b7R372

Changes:
```
> git log --format="%C(auto) %h %s" 6a7dd15..338a2c8
 https://dart.googlesource.com/tools.git/+/338a2c83 [api_summary] Include mixins in textual API summaries (2417)
 https://dart.googlesource.com/tools.git/+/c436f994 feat(api_summary): Move api_summary package into the tools monorepo (2412)
 https://dart.googlesource.com/tools.git/+/abd67801 [markdown] fix new lint RE await in an async function (2416)
 https://dart.googlesource.com/tools.git/+/fc11c6ea [code_builder] Expand code coverage (2409)
 https://dart.googlesource.com/tools.git/+/999a2df4 [code_builder] Emit ignore_for_file bits correctly (2406)
 https://dart.googlesource.com/tools.git/+/215ed97c [code_builder] Drop unused dev_deps and rebuild (2407)
 https://dart.googlesource.com/tools.git/+/6b99b07f Remove some extra spaces in unformatted output (2403)
 https://dart.googlesource.com/tools.git/+/2bf09dee Mark AnsiCode and AnsiCodeType final (2402)
 https://dart.googlesource.com/tools.git/+/03f2c205 publish cli_util version 0.5.1 (2397)
```

Diff: https://dart.googlesource.com/tools.git/+/6a7dd15748e63db7d41cfee8294c54636b668f41..338a2c8380059afb250a1d0c26555e4da24c6ccc/

Change-Id: I239f01adc4f0ba5e939e517abcaa1143d538c949
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507264
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2026-06-02 11:54:20 -07:00
Paul Berry e61679f449 Remove myself from the watchlist for _fe_analyzer_shared.
I'm keeping adequate track of changes to this package through other
means.

Change-Id: Ib247b5e94f8ffb351144faf09b55a5436a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508701
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2026-06-02 11:50:37 -07:00
Konstantin Shcheglov b389e23feb CQ. In DartObjectPrinter print full types of List, Set, Map values. Switch more tests to assertDartObjectText().
Change-Id: I66e078e571e9a5e803aed60911b519fe09d1ce7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508440
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 10:55:35 -07:00
Konstantin Shcheglov fe53326c60 Augment. Report augmentsConstantVariable and constantVariableAugmentation.
Change-Id: I19f2d7c4771a88e8b03599d386ef9d62a26e80e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 10:29:14 -07:00
Konstantin Shcheglov fb2c014693 CQ. Improvements to indexing and search around DirectSubtypeWithMembers.
Separate the subtype search entry points by result shape and caller
intent. Use `directSubtypeReferences` for reference locations in subtype
clauses, and use `directSubtypesWithMembersOfType` /
`directSubtypesWithMembersOfSubtype` for indexed direct subtypes with
their declared instance members.

Rename `SubtypeResult` to `DirectSubtypeWithMembers` so the model
matches what the search result actually represents. Update the server
member-collection logic to start from direct subtypes of the target type
and then walk direct subtypes by subtype id.

Introduce `SubtypeIndexElementId` as the single representation of
subtype index ids. This keeps id construction consistent between index
building and search, preserves the declaration file for declarations in
parts, and still exposes the element name separately for file-state
prefiltering.

Also make the subtype index expectations text-based so the expected
supertype id, subtype name, and member list are easier to read and
update.

Change-Id: Ice71d9b116aca83372bf595f6e58a8ce4aa9e9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-02 10:28:16 -07:00
Ryan Macnak 546bf07f7d [vm] Remove transitions for removing VM isolate.
TEST=ci
Change-Id: I65c315e9efc3cd7b8b47d2c167681986278644da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-02 10:28:10 -07:00
Brian Wilkerson dd66887ed7 Add an assist to move a field initializer into the declaration
The assist was originall written as a fix, but it's on the list of new
assists that we think users would find useful, so I made it also work
as an assist. The tests are just a copy of the tests for the fix.

The assist is available when the cursor is inside the name of a field
on the left side of a field initializer.

Unlike the lint, which only flags initializers if there is a reference
to a constructor parameter on the right side, the assist will move any
initialization expression. I think that's reasonable, but let me know
if you think we should limit it.

Change-Id: I4f6d90dbd510d5c93f0087933741d298939d4a49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-02 10:19:20 -07:00
Paul Berry 53a16c16e5 Bump package/front_end to language version 3.13.
This caused a minor change in the textual_outline output formatting,
so a couple of expectation files needed changing to avoid test
failures.

Change-Id: I538f89ff1d2cd7fb5f65b13eab1cf0cb6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507522
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 09:44:20 -07:00
Sam Rawlins 58dc2406b1 Update DevTools rev to 3eca94a79d17c9a3e77b51a2d2d6cb306cda9c2a
Change-Id: Icc409976bf83f0946d70a6aef215411348faf434
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508602
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2026-06-02 09:40:40 -07:00
Sam Rawlins c15aeb3da7 dartdev: Tidy and modernize analysis server code
This code seemed a little out of date and non-idiomatic. I used a few modern language features to help it to better comply with our team styles.

* Make declarations private if they can be.
* Make declarations final if they can be.
* Use factory constructors over static methods.
* Do not use type annotations that would be inferred.
* Use patterns for matching JSON data.
* Use extension type when appropriate.

Change-Id: Ib7ecbe51b6d8a94e56a51f84772952362c64049f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508424
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 09:35:48 -07:00
Ryan Macnak 8b4420c381 [infra] Shard Fuchsia ARM64 builder.
Also remove some dead Fuchsia scripts.

Change-Id: I87349973e2f192cb8472bb2b5c18049025950760
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508362
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-02 09:32:36 -07:00
Konstantin Shcheglov 164cfda948 CQ. Migrate ast_test to parseTestCodeWithDiagnostics and findNode.
Replace the local marker-based _AstTest helper in ast_test.dart with
ParserDiagnosticsTest parsing and the shared findNode utilities. This
keeps the tests aligned with the inline diagnostics style used by other
parser tests, and avoids a second way to locate AST nodes from marked
source snippets.

Update the affected tests to parse normal source text, then locate the
expected node through findNode single-node accessors. Add a
singleConstructorName accessor so constructor-name tests can use the
same shared lookup path.

Change-Id: Ib8c7c2e7c2c1b320c95810ce148b5a27e68dda43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-02 09:21:45 -07:00
Ryan Macnak 704638b670 [dartfuzz] Fix flag_fuzzer_dart2js to work with the reduced build set.
Change-Id: I26a15e326dec7426ae97d640b2ad00f9372ffa88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508601
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-02 09:00:10 -07:00
Johnni Winther 03ba5dabc2 [cfe][InternalNodes] Add InternalPattern hierarchy
This adds an internal class hierarch for patterns. This allows for the internal nodes to use InternalVariable rather than Variable and only contain the fields created during body building. This is a step towards separating Variable and InternalVariable fully.

Change-Id: I0e5241bc7163e0771d3420496b1f5ea02b433c87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508561
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-06-02 06:08:24 -07:00
Alexander Markov b6015976c9 [modular_aot] Fix splitting of a live range which has a split tail already
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I9d78195dcfd6f70f793c98710106fa5f1f8834c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508280
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-02 05:42:48 -07:00
Alexander Markov 7ff5e3654d [tfa] Fix handling of late local variables with static type Never
Initializers of late local variables are wrapped into closures.
The result type of a closure is a static type of the variable.
So initializer of a late variable with static type Never have a call
to a closure with static result type Never.

TFA summary collector handles calls with static result type Never
specially, treating all subsequent code as unreachable (by setting
control-dependent condition to empty). As a result, all subsequent
code after late variable with static type Never (and initializer) is
tree-shaken.

The fix is to avoid propagating control-dependent condition out of
the late variable initializers.

TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_63478.dart
Fixes https://github.com/dart-lang/sdk/issues/63478

Change-Id: If41221777c9d249dd21ce5827c586b0f531cbce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508363
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-02 05:42:19 -07:00
Tess Strickland 4b0a4e0a75 [vm,dyn_modules] Fix vm/cc/Profiler tests for dynamic modules.
The only actual change required to the profiler service is appropriately
retrieving the source position for interpreted frames during processing.

Otherwise, most of the tests just need small changes to account for the
slightly different stack trace generated by interpreted code when
walking the stack as code instead of functions:

* Interpreted code calls the runtime entry DRT_AllocateObject directly
  for slow-path allocation instead of via the AllocateObjectSlow stub.

* The current name for bytecode frames when walked as code starts with
  "[Bytecode]" instead of "[Unoptimized]".

The test vm/cc/Profiler_GetSourceReport is skipped since:

* It tests compiled code-specific features like classifying source
  positions.

* Inserting fake samples for interpreted functions is messier since
  many PC offsets may map to the same source position.

The other skipped tests are specific to inlining and/or optimized
compiled code, so there's no point in running them on interpreted code.

TEST=vm/cc/Profiler

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: I3e73f42b2562eb6e3e73fe8d5c3f14389039ee04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507082
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2026-06-02 04:50:53 -07:00
Tess Strickland 7558e63725 [vm,dyn_modules] Change handling of source positions for async returns.
The debugger assumes a null suspend state variable in an asynchronous
function means that the function is still in the prologue prior
to setting up the suspend state. However, the interpreter clears the
suspend state variable before returning, and the debugger needs to be
able to pause before returning when single stepping, so earlier a hack
was added to the debugger that detects being at the direct call of the
async return method and/or the return instruction with a null suspend
state variable.

However, there's a much simpler way of ensuring the debugger pauses
before returning: just emit the source position for the return prior to
clearing the suspend state variable. This also ensures that the debugger
still has access to the function's suspend state when pausing before
the return, instead of waiting until it has been cleared and thus is no
longer accessible.

TEST=ci (should not change the result of any current tests)

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: I401cceb169d8692ac379cdc5a531e07cafbe9a65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500740
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-06-02 04:28:41 -07:00
Ryan Macnak 1d5057e94d [build] Use ad-hoc code signing by default.
Change-Id: I00b483581a04bfb4a4ed0d6212c767d67c003f83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508164
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-06-02 02:39:40 -07:00
Simon Binder 567bf3337b [dart2wasm] Document standalone platform and include it in SDK
Given that the standalone target for dart2wasm is feature-complete now,
it makes sense to include it in released SDKs.

This adds the platform and outline files to built SDKs and exposes the
`--standalone` flag in `dart compile wasm`.
It also documents the standalone target in `pkg/dart2wasm/doc`, which
should be helpful as a starting point to use these compiled modules.

Change-Id: I5bd86e9670f03f2955e31789095dd5c462bf149e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506920
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-06-02 00:56:35 -07:00
Johnni Winther 7749454698 [cfe][PrimaryConstructors] Handle mixin class with primary constructor and fields
Because non-late field initializers in classes with primary constructors have access to the parameters of the primary constructor, field initializers are be moved to the initializer list of this constructor, so the generated AST will no access these parameters out of scope.

This CL add an exception to this rule for mixin classes:

In the non-erroneous cases, these can't have parameters, so the field initializers can stay in the field declaration. This is done to ensure that mixin transformation can
simply clone the mixin class fields, instead of having to fetch the initializer from the initializer list of the constructor.

For mixin classes with parameters in the primary constructor, which is an erroneous case, the initializers are moved to the constructor like for other
primary constructors to avoid generating an AST where the parameters are accessed out of scope.

Change-Id: Iff64992bce88368a524437c1856f50d779bf6a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507423
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-02 00:11:19 -07:00
Johnni Winther 4070db747a [cfe][PrimaryConstructors] Build initializers in const primary constructors
This updates the handling of initializers in primary constructor body declarations. The parser is updated to pass the `:` token, similar to what is done for the regular constructors. The CFE is updated to use a boolean, rather that the `:` token (or a synthetic token), to determine whether initializers should be processed as part of building the outline. The parsing of initializers is done using the `:` token, if any, now pass both from regular constructors and primary constructor body declarations.

Closes #63468

Change-Id: Ia266dea7946b30b02d56f9f3cedf40848c4ee440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507401
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-02 00:11:19 -07:00
Paul Berry bd65b86ada [analyzer_cli] Migrate to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the analyzer_cli package to use the new
constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) bumping the
package's SDK constraint to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Change-Id: I563e97f19c03ad0672dba271de303b786a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508367
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-01 22:05:51 -07:00
Sam Rawlins f91c6ba493 DAS plugins: Do not report the "dependency_overrides" section as illegal
Change-Id: Ib7c3f88569172821c04bce96c1fcae4aa13e05c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508372
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-01 18:46:52 -07:00
Paul Berry 3186c708a2 [testing] Migrate to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the testing package to use the new constructor
declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) bumping the
package's SDK constraint to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Change-Id: I01dab822f08d804d5c7ce997dee6d7866a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508427
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-01 18:04:45 -07:00
Paul Berry d7f200b97d [kernel] Migrate to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the kernel package to use the new constructor
declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) bumping the
package's SDK constraint to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Change-Id: I8d32a0b26450a44dfa2ebd9fe2dff9df6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508426
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-06-01 17:48:34 -07:00