Commit Graph

112384 Commits

Author SHA1 Message Date
Martin Kustermann f32057642b [dart2wasm] Run an additional -Os in open world compilation
This reduces e main module size by ~ 0.5-1%

When compiling with deferred loading, we optimize each module
individually with open world assumptions.

Currently we run only one -Os pass which leaves code behind that can be
optimized by another -Os. See e.g. discussion at [0].

The additional -Os pass is much faster than the first, so it doesn't add
meaningful compile-time.

[0] https://github.com/WebAssembly/binaryen/issues/8077

Change-Id: Id8c5e49d97439e28b2f7d9c5a0c206eec0893cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490101
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-03-24 13:07:26 -07:00
Johnni Winther 9f2bb62d83 [cfe][PrimaryConstructor] Infer dynamic for non-declaring parameters
This changes the inference of omitted types in non-declaring parameters to use dynamic instead of Object? as used by declaring parameters.

Closes #62935

Change-Id: I596566097b87cc8b3718355aaf2ce7bf40582b6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490103
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-03-24 12:59:54 -07:00
Johnni Winther 053526f2f5 [cfe][PartsWithImports] Add tests for deferred siblings
This adds an expectation test for having the same deferred prefix in two sibling parts. This verifies that the AST encoding correctly disambiguates the prefixes.

Part of #56193

Change-Id: I5b5039989851738acf72343f3cf4742a521dfb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-03-24 12:59:23 -07:00
Leon Senft 500c7f6893 Remove myself from OWNERS_WEB
I'm not an owner nor maintainer of anything in this repository.

R=rmacnak@google.com

Change-Id: Ibcb926990ffdbda46617d7f95c1610805f3ad5dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490340
Auto-Submit: Leon Senft <leonsenft@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-03-24 12:24:00 -07:00
Konstantin Shcheglov 5b95c921b1 CQ. Fix places where unnecessary_local_variable reported.
See https://dart-review.googlesource.com/c/sdk/+/489502

Change-Id: Id2f92bd3eb667d642ec72f6e356b4cac71000219
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489542
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-03-24 12:15:52 -07:00
Ben Konyi 6ea62c02fe [ Service ] Run the service's main() via _runMainIsolate
Prior to this change, the VM service isolate was configured to execute
`main` directly. This resulted in unexpected behavior around exceptions
thrown after the first asynchronous gap, which were unhandled but caused
the service isolate to exit silently with no error.

This change updates how the service isolate starts execution by
invoking `main` via `dart:isolate`'s `_runMainIsolate` method, similar
to how user isolates and the DartDev isolate start execution. This
results in the message handler being triggered, meaning the microtask
queue will be processed correctly and unhandled exceptions in
asynchronous contexts being reported.

TEST=Local testing with exceptions explicitly thrown from within the VM
service

Change-Id: I69475a86d923489fa216bc8e939a2726cf3ff2e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-03-24 11:57:40 -07:00
Konstantin Shcheglov 9eb172e685 Elements. Add types for recently fixed TOP_MERGE bugs.
See https://dart-review.googlesource.com/c/sdk/+/490120

Change-Id: I26451c651fb57d90f09ca5a62be02e859ac63a1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-03-24 11:40:21 -07:00
Ryan Macnak 0a30a91dd7 [vm] Update ApiNativeScope to C11 thread locals.
TEST=ci
Change-Id: Iec314b13981c0cd11f6dd28c2e881281c3a10a8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490300
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-03-24 11:26:23 -07:00
Sam Rawlins b833f0f769 analyzer: Shrink api of AnalysisOptionsProvider
The `getOptions` and `getOptionsFile` were unused except in the tests
which tested them. These are removed.

`merge` is unused outside the library except for its test, so it is
made `@visibleForTesting`.

Change-Id: Id2e45dca7aa4f744fc84627d8e2a097d3ef98b10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490040
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-03-24 10:33:26 -07:00
Nourhan Hasan 596e0b0849 [vm/service]: expose Pointer<T> address in VM Service Protocol
Pointer<T> instances were previously serialized as PlainInstance
with no address, making them opaque to all debugger clients.

TEST=pkg/vm_service/test/get_object_rpc_test.dart

Fixes: https://github.com/dart-lang/sdk/issues/62853
Change-Id: Ia44eb0fa0851332409680d8d593141fe25505114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486460
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Nourhan Hasan <nourhan.m.hasan@gmail.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-03-24 10:23:38 -07:00
Danny Tuppeny f300269d0c [analysis_server] Exclude NameWithTypeParameters from selection ranges
This makes things more consistent between class/mixin (that have different ASTs) but also avoids jumping to the name+type args which probably isn't what you'd expect.

Change-Id: Ibd5e2a9b332c4c214ccc753080a61b1222445485
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-03-24 10:20:30 -07:00
Erik Ernst 25fe38a262 Adjust _parameterKind to fix topMerge
This CL changes the analyzer such that it forces formal parameters
to have the same properties during NNBD_TOP_MERGE (`topMerge`).
The implementation prior to this CL considered two optional positional
parameters to yield a required positional parameter in the merged
result, and it allowed merging a required named parameter and a
non-required named parameter. This implies that certain mergings
that used to succeed will now fail, but this is not a breaking change
in practice because the common front end already uses the more strict
checks that this CL introduces in the analyzer.

Change-Id: I9121db3754e422f5fab143f9990e58e210ed951e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490120
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-03-24 09:19:59 -07:00
David Morgan f58991b35b Remove augmentation libraries test as it's out of date with the spec.
Change-Id: I6b85558dd3e135612ad45b07aa74e8e85e3321a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490102
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-03-24 08:59:23 -07:00
Johnni Winther af1a31dc84 [cfe] Skip addSuperParameterDefaultValueCloners when the constructor has no super initializing formals
Initializers are created for outlines for const constructors and for constructors with super initializing formals. This led the addSuperParameterDefaultValueCloners method to process the initializers even when the constructor has no super initializing formals; crashing in the case of const redirecting generative constructors. The addSuperParameterDefaultValueCloners method now stops early if the constructor has no super initializing formals.

Change-Id: I2d640b20ac3fb281705b61362157e1fd09eed3f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490081
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-03-24 07:57:49 -07:00
Slava Egorov 618d608c81 [perf_witness] Fix -o behavior with relative path
Target process and the recorder might be running in different working
directories so request to start recording should always use absolute
path.

This also cleans up how file recorders are created: it does not make
sense to create the recorder and the check if we can open the file
(in fact: creating recorder and failing to open file will cause
deadlocks). Thus this CL changes the code to first open the file
and only if we succeeded creates the recorder.

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

TEST=extended existing tests to cover this

Change-Id: Ib9d88ce23d93bcc5d6335ba1daebad2e6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490160
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-03-24 06:46:47 -07:00
Lasse R.H. Nielsen cdd8311b14 Make VM run microtasks after an event handler throws.
Tested: Test added for fix.
Change-Id: Ifbefb01ef0caf9de80e44c44e5de4cc51bb129cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-24 06:36:04 -07:00
Jens Johansen 4d3d70af23 [kernel] Format kernel
Kernel sdk version was bumped from 3.6 to 3.12 in
https://dart-review.googlesource.com/c/sdk/+/487542 (and to `^3.12.0-0`
in https://dart-review.googlesource.com/c/sdk/+/487880) but the source
was never formatted.

This is, if nothing else, bad for reviews, where editing a file changes
the file in lots of places because of new formatting.

This CL is the result of running

```
out/ReleaseX64/dart-sdk/bin/dart format pkg/kernel/
```

but also updates the formatter version used by a source generator
(`pkg/front_end/tool/visitor_generator.dart`) so things agree.

Change-Id: I66e35d4f1e2d08cecc30fb314546cae78b49e99b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490082
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-03-24 06:00:44 -07:00
David Morgan 9ad39ca351 Revert "[test_runner] Support static error test expectations in augmentation libraries."
This reverts commit 261e16e822.

Reason for revert: The feature no longer specifies "augmentations libraries", see 1.22 in the changelog. https://github.com/dart-lang/language/blob/main/working/augmentations/feature-specification.md

Original change's description:
> [test_runner] Support static error test expectations in augmentation libraries.
>
> R=eernst@google.com
>
> Change-Id: I52fd157be6ba561f571170ce393d80820b2744dc
> Bug: https://github.com/dart-lang/sdk/issues/44990
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356401
> Reviewed-by: Erik Ernst <eernst@google.com>
> Auto-Submit: Morgan :) <davidmorgan@google.com>
> Commit-Queue: Morgan :) <davidmorgan@google.com>

Bug: https://github.com/dart-lang/sdk/issues/44990
Change-Id: Ifbba5d7f7d2720bac3dc638ca00c96246b6fef95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490100
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2026-03-24 05:22:10 -07:00
Jens Johansen fac7b19029 [analyzer] [_fe_analyzer_shared] Add Stack.popNonNullableNewList; use in popTypedList2
When analyzing the CFE with StableAnalysis in AOT with GC disabled:

* This CL reduces the combined cost of `popTypedList2` from ~501 million
  instructions to ~150 million instructions according to
  `valgrind --tool=callgrind`.
* Total savings, via `valgrind --tool=callgrind`, is reported as
  ~359 million instructions.
* Total savings, via `perf stat`, is reported as
  ~367 million instructions (see also below).

A benchmark run with 5 runs each gives this (but note that the normal gc
runs should mostly be ignored):

With normal GC:

```
page-faults:u: 2.5544% +/- 0.0884% (4895.60 +/- 169.43) (191651.60 -> 196547.20)
instructions:u: -1.7106% +/- 0.0039% (-990609348.00 +/- 2286578.79) (57909229892.40 -> 56918620544.40)
branch-misses:u: -4.0211% +/- 2.2322% (-7537436.00 +/- 4184151.25) (187447442.80 -> 179910006.80)
maxRssKbytes: -1.1530% +/- 0.0148% (-7169.60 +/- 91.81) (621801.60 -> 614632.00)
maxRssBytes: -1.1530% +/- 0.0148% (-7341670.40 +/- 94008.95) (636724838.40 -> 629383168.00)

Comparing GC data:
Scavenge(   new space) goes from 171 to 169
MarkSweep(   promotion) goes from 17 to 16
MarkSweep(   old space) goes from 0 to 1
Notice combined GC time goes from 3636 ms to 3507 ms (notice only 1 run each).
```

```
With GC disabled:

page-faults:u: -1.7322% +/- 0.0001% (-21490.20 +/- 1.49) (1240629.60 -> 1219139.40)
instructions:u: -0.9185% +/- 0.0021% (-367119249.20 +/- 829664.80) (39970048410.80 -> 39602929161.60)
maxRssKbytes: -1.7226% +/- 0.0012% (-85733.60 +/- 60.60) (4977076.00 -> 4891342.40)
maxRssBytes: -1.7226% +/- 0.0012% (-87791206.40 +/- 62052.71) (5096525824.00 -> 5008734617.60)
```
Change-Id: I85eae091cc45d5fb2820fbd263d022619c9875f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490122
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-03-24 04:21:46 -07:00
Martin Kustermann 9d969a1c50 [dart2wasm] Roll binaryen to newer version
Change-Id: Ie7b31cc4530f86977e16ea9237ebd557c4cb1aee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490060
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-03-24 04:11:35 -07:00
Jens Johansen a71d98f1e5 [analyzer/linter] _AllowedCommentVisitor.visitCompilationUnit doesn't need a list
This saves ~30 million instructions when analyzing the CFE.

Change-Id: I50a79d67e777447b97089140c7ecdeeb726284de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489941
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-24 00:14:04 -07:00
Jens Johansen f19d52e683 Reduce cost of regex in LanguageVersionOverrideVerifier
Guard the regex call by the comment containing `@`.
This makes `LanguageVersionOverrideVerifier.verify` goes from costing
~122 million instructions to costing ~81 million instructions saving
~41 million instructions.

Change-Id: Ib7068624bf7570873180fc1be33db0a3e53a0fca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489962
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-03-24 00:14:02 -07:00
Sam Rawlins e06cdb847e analyzer: Make SourceFactory.resolveUri take non-nullable parameters
The function mostly returned null/nonsense if given a null argument,
and the few call sites with nullable arguments (in tests and tools)
are easily tweaked.

Change-Id: I7f9993696c4bd822b648a5a89114e6af25eac552
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-03-23 20:43:22 -07:00
Konstantin Shcheglov 587434218a Augment. Remove redundant forAugmentationLibrary flag, use libraryFeatures.augmentations instead.
Change-Id: If6e5ce47e93d95c33ad796d21888d26d93f46735
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489980
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-03-23 18:58:30 -07:00
Dexter.k 15cdd9152e Fix unused_element false positive for constructors used via mixin
Closes https://github.com/dart-lang/sdk/pull/62922

GitOrigin-RevId: 72f0d5dfe6beb51a5109f4b8982b15ffdc64069f
Change-Id: Ib0857acdb71c38cd6c2cef0cb418ca40a8968ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488526
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-03-23 15:05:27 -07:00
Danny Tuppeny c1ebd226ea [analysis_server] Mark the dart.lineInfo setting as deprecated in LSP docs
This should be set in `analysis_options.yaml` now (since it applies to all IDEs and CLI invocations of tools). I've also marked this as a legacy setting in Dart-Code.

See https://github.com/Dart-Code/Dart-Code/issues/5943.

Change-Id: Ief585c08f1986afc2ddc40bc66b921bc368139a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-23 14:35:20 -07:00
Danny Tuppeny 88bbb2c09b [analysis_server] Add tests for empty bodies in LSP SelectionRanges
Change-Id: I0bbd45277e942bdfabcdc1e1737f2cef048a1269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-23 14:00:09 -07:00
Kallen Tu 7481d41941 [tests] Primary constructors - Add const initializer and body tests.
Tests for the spec change in https://github.com/dart-lang/language/pull/4655.

- An identifier expression denoting a parameter of a constant primary
constructor that occurs in the initializer list of the body part of the
primary constructor, or in an initializing expression of a non-late
instance variable declaration, is potentially constant.
- A compile-time error occurs if a class, mixin class, enum, or
extension type declaration has a constant generative constructor, and a
non-late instance variable declaration in the body of the declaration
has an initializing expression which is not potentially constant.
- A compile-time error also occurs if the body of a declaration contains
a body part for the primary constructor, and it has an initializer list,
and the initializer list contains an expression which is not potentially
constant.
- A compile-time error occurs if the result of substituting actual
arguments of the constructor invocation into one of the above mentioned
initializing expressions or initializer list elements yields an
expression which is not constant.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: I8f9d5d49ab48f6cd07ad005b9483e21ef190f324
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489543
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2026-03-23 13:59:04 -07:00
Martin Kustermann 07ccf9b80e [dart2wasm] Reduce large strides of consecutive class ids in dynamic dispatch table
This removes main module size by around 8% uncompressed and
0.5% compressed. It thereby compensates the uncompressed size
introduced in [0]

This is the dual to [1] - just for the class id table.

[0] https://dart-review.googlesource.com/c/sdk/+/487660
[1] https://dart-review.googlesource.com/c/sdk/+/488720

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

Change-Id: Ib305a4129057ca86b3e6464d73aa4717609e37e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489920
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-03-23 12:37:59 -07:00
kevmoo 193e53076c Use ^3.12.0-0 instead of -edge
Otherwise folks on ~latest bits from Flutter can't run pub!

Resolving dependencies in `/Users/kevmoo/github/dart/sdk`...
The current Dart SDK version is 3.12.0-261.0.dev.

Because dart_runtime_service_vm requires SDK version ^3.12.0-edge, version solving failed.

Change-Id: I76af81c9f6d9360a347300a1b8bac479ee45c631
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489640
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-03-23 11:20:48 -07:00
Sergey G. Grekhov 2de6d3f3e8 [co19] Roll co19 to ffd6f44bfcbed7ff58a6b204d5ba33fe4394f274
2026-03-20 sgrekhov22@gmail.com Fixes dart-lang/co19#3682. Fix roll failures (dart-lang/co19#3683)
2026-03-20 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 19. (dart-lang/co19#3680)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 18. (dart-lang/co19#3679)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 17. (dart-lang/co19#3678)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 16. (dart-lang/co19#3677)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 15. (dart-lang/co19#3676)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 12. (dart-lang/co19#3673)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 13. (dart-lang/co19#3674)
2026-03-19 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 14. (dart-lang/co19#3675)
2026-03-18 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 11. (dart-lang/co19#3672)
2026-03-18 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 10. (dart-lang/co19#3671)
2026-03-17 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 9. (dart-lang/co19#3670)
2026-03-17 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 8. (dart-lang/co19#3669)
2026-03-17 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 7. (dart-lang/co19#3668)
2026-03-17 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 6. (dart-lang/co19#3667)
2026-03-17 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 5. (dart-lang/co19#3666)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 4. (dart-lang/co19#3665)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 2. (dart-lang/co19#3663)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3182. Add tests for augmenting of `new` and `factory` constructors (dart-lang/co19#3634)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 3. (dart-lang/co19#3664)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete `var` syntax. Part 1. (dart-lang/co19#3662)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3182. Add tests for static abstract declarations. Part 2. (dart-lang/co19#3642)
2026-03-16 sgrekhov22@gmail.com dart-lang/co19#3641. Add more tests for permitted use of type `void`. Part 3. (dart-lang/co19#3655)
2026-03-14 sgrekhov22@gmail.com dart-lang/co19#3203. Add tests for a primary constructor with a body (dart-lang/co19#3660)
2026-03-13 sgrekhov22@gmail.com dart-lang/co19#3315. Add some missing cases to primary constructors tests (dart-lang/co19#3661)
2026-03-13 sgrekhov22@gmail.com dart-lang/co19#3641. Add more tests for permitted use of type `void` (dart-lang/co19#3647)

R=athom@google.com, eernst@google.com

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try
Change-Id: If777a9880b4f7413b0815da684b7c92258b819b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489860
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2026-03-23 08:55:23 -07:00
Paul Berry 1b1c5d55dc [_fe_analyzer_shared] Move analysis of await expressions to shared logic.
Moves the bulk of the business logic for type analyzing await
expressions from the analyzer and front_end codebases into the shared
`TypeAnalyzer` class. There is no functional change.

This paves the way for fixing
https://github.com/dart-lang/sdk/issues/62889 (Unsound type promotion
in inner async/generator functions), which will require the type
analysis of await expressions to be integrated more closely with flow
analysis. Sharing the type analysis logic will avoid the need to do
that integration twice.

Change-Id: I9f8770ce8127a960b746a89ee3e370ed6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489480
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-03-23 08:29:55 -07:00
Danny Tuppeny 0b5a913de8 [analysis_server] Add Document Symbol + Outline tests with empty bodies
Change-Id: I77e901475c802dc4649ec09097618f2e5787fb7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-23 07:32:44 -07:00
Fedor Shcheglov fe0bdac54f Fix a bug where augmentation was incorrectly associated with the macro feature, rather than the augmentations feature.
Added additional tests to ensure validity of this change.

This didn't cause issues in unit tests, because all of them had macros
enabled in their superclasses.

Add TODO for named mixin applications: mixin application classes can't
be augmented.
(https://github.com/dart-lang/language/blob/main/working/augmentations/feature-specification.md#augmenting-class-like-declarations)

Change-Id: Ieaaec84d16ca8cf6d103c9c905fdfa2c0b7c8ca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-03-23 07:26:18 -07:00
Paul Berry 4f46f8bc9c [_fe_analyzer_shared] Plumb isVoidAllowed through dispatchExpression.
In the front end, the logic for determining when to report a
`voidExpression` error is integrated into the resolution pass. The
method `InferenceVisitorImpl.inferExpression` accepts a named
parameter `isVoidAllowed`; if the value is `false`, and the
expression's static type is `void`, an error will be reported. The
parameter is optional with a default value of `false`; this means that
the parameter only needs to be specified in the situations where
`void` is allowed; this aligns well with the language spec, which
lists the situations in which an expression may have type `void`, and
declares that in all other situations it is an error.

This change integrates the front end's `isVoidAllowed` boolean with
the shared type analysis logic in `package:_fe_analyzer_shared`, so
that the shared logic can specify when a subexpression should not be
void. This will pave the way for fixing
https://github.com/dart-lang/sdk/issues/62939 (Switch scrutinees of
type void are erroneously accepted by the front end). It also will
pave the way for sharing the logic for analyzing await expressions,
which will make it easier to fix
https://github.com/dart-lang/sdk/issues/62889 (Unsound type promotion
in inner async/generator functions).

Note that the analyzer doesn't use the `isVoidAllowed` parameter; it
has its own mechanism for detecting invalid uses of void (which is
more ad hoc). In the long run I would like to make the analyzer's
mechanism more like the front end's, for easier code sharing; see
https://github.com/dart-lang/sdk/issues/62942.

Change-Id: Ibb8dd072d6aff980d7df0b2e94f434ee6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489501
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-03-23 07:20:57 -07:00
Paul Berry 4cd5f95411 [_fe_analyzer_shared] Add the ability to test ExpressionTypeAnalysisResults.
Adds the unit test method
`ProtoExpression.checkExpressionTypeAnalysisResult`, which allows unit
tests of the shared analysis logic to access the object returned by
`TypeAnalyzer.dispatchExpression`.

This replaces ad-hoc logic that was used to test
`IntTypeAnalysisResult.convertedToDouble`, and allows testing of
`PatternAssignmentAnalysisResult.patternSchema` (which was previously
not covered by unit tests).

It also paves the way for shared analysis code I intend to introduce
for await expressions, as part of fixing
https://github.com/dart-lang/sdk/issues/62889.

(In principle, this mechanism could also be used to test the fields in
`SwitchExpressionResult`, but I believe I can refactor the code in
such a way that that class is no longer necessary, so I will try doing
that in a follow-up CL. If that doesn't work out, I'll add tests of
`SwitchExpressionResult` in a follow-up CL.)

Change-Id: I571c55f708b03e67ab491994675e53e16a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-03-23 07:18:15 -07:00
Sam Rawlins 65a5876e0d [front_end] Remove dead code regarding null values in collections of non-null values
These will soon be reported by the analyzer for
https://github.com/dart-lang/sdk/issues/57101.

Change-Id: I7fe2a9dca107c8c69b5dff0f527fa501c41a2c74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489503
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-03-23 07:12:02 -07:00
Chloe Stefantsova b02a83e114 [cfe] Enable super initializers with new variables in constant evaluator
This CL adjusts the predicate `_isFormalParameter` in the constant
evaluator, so that it includes variables from the new
model. Additionally, `IntenralPositionalParameters` and
`InternalNamedParameters` that were emitted as parts of function
declarations are replaced with their corresponding `astVariable`s in
the output.

The CL allows to unskip the last test in the bytecode generator when
the new variable model is enabled.

Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: Ibb8df47bf53f7f31aab58f8d5d104192edc83718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489380
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2026-03-23 06:47:10 -07:00
Chloe Stefantsova e07e723707 [cfe,dart2bytecode] Apply model-agnostic isThisExpression predicate
In the new model `ThisExpression` is replaced with a `VariableGet`
referring to `ThisVariable`. This CL introduces the model-agnostic
predicate `isThisExpression`, which is applied to replace is-checks on
`ThisExpression`.

The changes in this CL allow to unskip the test `type_ops.dart` in
`bytecode_generator_test.dart`.

This CL is also a follow-up to
https://dart-review.googlesource.com/c/sdk/+/488780/1/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart#3481

Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: I9d56ea6a648dc8d299d9a9692b4ffa4459221147
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489100
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-03-23 06:47:10 -07:00
Paul Berry ea14f51214 [_fe_analyzer_shared] Sort declarations in mini_types.dart.
There is no functional change.

Change-Id: I610b03156197ffc4aac85467d3b138536a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489420
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-03-23 05:39:57 -07:00
Ben Konyi 2a83a78213 [ DAS ] Add initial support for widget preview detection service
The Flutter Widget Preview feature is currently implemented within
Flutter Tools, which is responsible for detecting widget preview
annotations in the user's project. When previews are detected, the
Flutter Tool injects code generated based on the detected previews into an artificial widget_preview_scaffold project and performs a hot reload to render updates to the preview set in the scaffold application.

`package:analyzer` is currently being used to detect previews, but this comes with a significant amount of memory overhead. Since widget
previews are mostly being used from within IDEs which already have an
active analysis server, moving widget preview detection into the DAS
will remove the need for creating an additional analysis context in the Flutter Tool itself.

This change includes the initial work to move widget preview detection
into the DAS. It utilizes a pull-based mechanism, where the Flutter Tool listens for file system events and then queries the DAS using the `dart/textDocument/getFlutterWidgetPreviews` and `dart/workspace/getFlutterWidgetPreviews` LSP methods.

Each reported preview contains some generated code based on the annotation used to define the preview. This code has all constants from the original annotation evaluated to either primitive values or constant expressions with namespaces applied to each symbol, allowing for the Flutter Tool to inject this code directly when updating the generated code in the scaffold project.

Towards https://github.com/flutter/flutter/issues/179584

Change-Id: I043cb3235a66b25dda3f852ca7f147bff0e1e537
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478100
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-03-22 19:19:03 -07:00
Ben Konyi 086cb1a441 [ Service ] Add HTTP and DevFS support to package:dart_runtime_service
This change adds support for invoking RPCs via HTTP requests, allowing
for interacting with the service without needing to establish a web
socket connection.

This change also adds support for the development file system, otherwise
known as DevFS. DevFS is a (currently) undocumented feature provided by
the VM service that gives clients limited file system access within a
directory contained in the system's temp directory. This is currently
used by Flutter to push kernel files to the device when performing a hot
reload.

The DevFS implementation for package:dart_runtime_service_vm removes
the long deprecated support for `path` parameters, leaving `uri`s as
the only supported format for specifying file system types. Existing
DevFS tests have been updated to replace `path` with `uri` in
preparation for dart_runtime_service_vm becoming the new default VM
service.

This change brings the package:vm_service test suite pass rate to ~95%.

Change-Id: Ib7d95db5788c37408d3dec79926ca7206660a43f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488280
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-03-20 15:23:38 -07:00
Sam Rawlins 2a3e95bdb6 [js_ast] Remove dead code regarding null values in a List of non-null values
These will soon be reported by the analyzer for
https://github.com/dart-lang/sdk/issues/57101.

Change-Id: Ic18f70134ac5ccbad3b191016a82df54c3168f41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489541
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-03-20 14:14:52 -07:00
Sam Rawlins 43b930673e analyzer: Use Workspace.partialSourceFactory in more places
For better caching.

Change-Id: Ia5c9df85169731ae256dfe68cfe54115a9b402f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2026-03-20 13:52:02 -07:00
Konstantin Shcheglov 6a62dbbb0f Fine. Include DirectiveUri signatures into element bundle and resolution keys.
Bug: https://github.com/dart-lang/sdk/issues/62859
Bug: https://github.com/dart-lang/sdk/issues/62860
Change-Id: I31d6269cb567c1922cc5b36aa0b06ee112d990a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489300
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-03-20 13:00:29 -07:00
Sam Rawlins 05a7cecc21 linter: Remove unused enum value
These are not yet reported by the analyzer... but it's conceivable that
the analyzer could report them.

Change-Id: Ifbc507bc7b0978cf5f41d20d37a50f3c8a7fab41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2026-03-20 10:28:13 -07:00
Konstantin Shcheglov 97130a62a6 CQ. Update ResolvedAstPrinter to output AST in the after-refactoring format.
Bug: https://github.com/dart-lang/sdk/issues/62799
Change-Id: I1cf0bfc8d30bb47723c773500a020f128dbb5232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488980
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-03-20 10:03:57 -07:00
Brian Wilkerson 49d7307b51 Add tests for avoidTypesAsPrimaryConstructors
Change-Id: I602b8d55f52cdf7efeabf721b9e94430d528d7c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488602
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-03-20 09:50:46 -07:00
Daco Harkes 9fb3e4ce4f [deps] Roll devtools to be1d7ba3dddc84a6c6b0d4dca9ab62b8b3b24d29
Change-Id: I7fd69a5f6b7ebfaab0ee86e8db67ada83db89b55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489360
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2026-03-20 09:42:17 -07:00
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00