Commit Graph

111940 Commits

Author SHA1 Message Date
Slava Egorov a2b1bb421a Add .vpython3 spec for Perfetto.
Perfetto gn/write_buildflag_header.py requires at least 3.9 because
it uses type hints like list[str].

Without the spec Flutter bots try to run it using Python 3.8.x which
fails.

Change-Id: I34fb038c591705220481ee8e3036a4626a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-02-25 02:50:41 -08:00
Jessy Yameogo 023d12877a [corelib] added entry to status file for group_modifier_test
Safari currently lacks support for new RegExp group modifiers, causing `group_modifier_test.dart` to fail on `dart2js-mac-safari` and `ddc-mac-safari`. This change explicitly marks the test to expect a `RuntimeError` on these configurations rather than skipping it entirely.

Fixes https://github.com/dart-lang/sdk/issues/62753
Change-Id: Iff2007a7b50ee2a4a29f6e7aecbc1930ccdf8967
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483380
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-02-24 17:48:27 -08:00
Robert Nystrom 17ac34f321 Roll a new dart_style into the SDK.
There is only one very small formatting change that only affects code
when "preserve trailing commas" is on. We generally leave that off in
the SDK and in google3. So this should be safe to roll in.

I'd like to publish a version of the dart_style that supports 3.12 to
pub soon, but I already merged the above chain on main, so I want to
roll it into the SDK and google3 first.

Change-Id: I21e84b7d69be300929b3919d73107939f1050727
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483421
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2026-02-24 17:39:02 -08:00
Robert Nystrom 207e8f6f3c Change the ConvertToInitializingFormal availability to allow it in dart fix.
Change-Id: I9dc2a579f5c7a832bc3ba2adc4ea0ad965845397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-24 17:13:50 -08:00
Ryan Macnak d5e2f31993 [vm] Fix race compiling regexp.
TEST=iso-stress
Change-Id: I013d7d91d37b62ed60d7f067a62c6f419c0d0a7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483362
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-02-24 15:23:18 -08:00
Konstantin Shcheglov 96611671aa DeCo. Move more declaration visiting into ScopeContext
Add ScopeContext helpers for visiting function- and method-related
declarations, and route existing visitors through them to reduce
duplicated scoping logic.

This centralizes the ordering and scopes for:
- FunctionTypeAlias
- FunctionTypedFormalParameter
- GenericFunctionType
- GenericTypeAlias
- MethodDeclaration

As part of the refactor, ResolutionVisitor now delegates these nodes to
ScopeContext and computes FunctionTypedFormalParameterElement.type from
the element’s own type parameters and formal parameters, avoiding
fragment-to-element remapping.

The generated resolver and summary reference resolver are updated to use
the new helpers while preserving their extra hooks (e.g. setting
nameScope/LinkingNodeContext, controlling body traversal, and ensuring
documentation comments are visited in the correct parameter scopes).

Change-Id: I8384e68a89f1ff0fa61fab9434e22fd9c703693f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483363
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-02-24 14:38:39 -08:00
Konstantin Shcheglov 19895724dd Breaking changes for analyzer version 11.0.0
Change-Id: I75c4dca69a99c0129cc8ae6934d5925382228a00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481542
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-24 14:36:29 -08:00
Brian Wilkerson 2be889b59f Update completion to suggest new in class-like bodies
Primary constructors introduces the ability to use `new` in place of
a class name in a constructor. The previous changes to code completion
missed this, but this CL causes `new` to be suggested at the beginning
of a member.

Change-Id: I56ac6d3d8649e55de264f6e4f91b4c5db2e37c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483322
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-24 11:45:39 -08:00
Ben Konyi 992a80cef4 [ Service ] Add stream support to package:dart_runtime_service
Adds support for `streamListen` and `streamCancel`. Service extension
events are now sent on the `Service` stream when extensions are
registered and unregistered.

Change-Id: I024e6e1fc214ee3f882463c3eed50700c27c6364
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479360
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-02-24 11:36:53 -08:00
Konstantin Shcheglov b8006c7e7c AD. Include 'workState' into assertDriverStateString.
State dumps produced by assertDriverStateString previously focused on
the file system and library context, which made it difficult to debug
why a driver was (or was not) doing work. In particular, there was no
visibility into queued file changes, pending tracker sets, or the
driver’s current priority.

Extend the state printer to include a dedicated driver/workState section
that captures the scheduler-facing view of pending work, including:
- priority files and pending file changes
- file tracker queue sizes and pending/changed file sets
- current work priority

In the future I plan adding more addFile / changeFile / removeFile
tests, and would like to get more visibility into the state.

Improve expectation failures in resolution tests by printing a pretty
diff and failing immediately, instead of dumping the entire actual
output and then running an additional equality assertion.

Change-Id: I98a97bb50b9bf6bbd85bb90039c4080a813485cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482968
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-24 11:32:15 -08:00
Ryan Macnak 240b9bef03 [build] Enable ICF for Mac.
xcodebuild/ReleaseARM64/exe.stripped/dart -131k (-3.25%)

Change-Id: I9d3f4f39c77bb242e891e1996e217923bbc55d0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482984
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-24 11:08:51 -08:00
Srujan Gaddam 0615d3a467 [dart:js_interop] Make isA<JSExportedDartFunction>() check that it's a wrapped function
Closes https://github.com/dart-lang/sdk/issues/62573

isA<JSExportedDartFunction>() used to just check if the object
was a function, leading to a possible runtime error if `toDart`
is called. Fixes that by introducing some helpers and moving
around some functions in the JS compilers to other internal
libraries (public members can't be added to
js_allow_interop_patch.dart). Also fixes a minor issue in dart2js
where `allowInterop`ed functions could successfully invoke
`JSExportedDartFunction.toDart`.

CoreLibraryReviewExempt: Documentation change.
Change-Id: I5a9d7c31d3143eb3fb6ebd3273a4bf06ca329479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482967
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2026-02-24 10:40:43 -08:00
Ryan Macnak c87555403c [vm] Avoid heap walk for AOT profiler.
TEST=pkg/vm_service
Change-Id: I6d5d6cc5d6f879f8a0e128c7862d0ff031552211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482963
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-02-24 10:24:31 -08:00
Ryan Macnak 5e173fa736 [vm] Mark natives as unreachable in gen_snapshot.
This allows a great deal of linker GC resulting in a much smaller binary. The benefit multiplies for Flutter development because the Flutter tool downloads many variant copies of gen_snapshot.

out/ReleaseX64/exe.stripped/gen_snapshot -1.55M (-23.4%)

TEST=ci
Change-Id: I9f6e650f78ea52c9c6953320a669b71019403236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482965
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-02-24 10:08:30 -08:00
Alexander Thomas c87098e0ab [docs] Clarify how to force submit in Gerrit
Change-Id: I3f7a273e96e8e05aaf6075b87333cc3bad780a9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483180
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2026-02-24 09:33:20 -08:00
Alexander Markov 0ec57dd561 [vm,modular_aot] Initial code generation for static field loads and stores
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I07aa7cabf8fe78c0f98c17b98ae85bdc903b99c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482920
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-02-24 08:54:39 -08:00
Konstantin Shcheglov 9fba196eea DeCo. Different scopes for primary constructor formal parameters with and without Feature.primary_constructors.
Extension type primary constructor (representation) parameters must be
resolved in different name scopes depending on whether the primary
constructors are enabled for the library.

When `Feature.primary_constructors` is enabled, treat the primary
constructor as being inside the body and resolve its formal parameters
inside `withInstanceScope`. This matches the DeCo model and preserves
the pre-existing analyzer behavior.

When the feature is disabled (for example `// @dart = 3.10`), the
representation parameter list is outside the body and must be resolved
in the enclosing scope, before entering the instance scope. Previously
we when implementing primary constructors feature, we resolved it inside
the instance scope unconditionally, which would cause semantic changes
to pre-feature code. But I think this is a rare corner case.

Example of the incorrect analysis in `@dart = 3.10` mode:

extension type A(int it) {
    static const String int = 'not a type';
  }

Before this change, `int` was resolved to the static member `A.int`,
leading to `notAType` and an `InvalidType` for `it`. After this change,
`int` resolves to `dart:core::int` as intended for 3.10, while
primary-constructors mode continues to report the shadowing error.

Also centralize access to the library `FeatureSet` to keep scope
construction consistent.

Bug: https://github.com/dart-lang/sdk/issues/62622

Change-Id: I22912c55bf12f2dc9465bcf32e6d32f9b21a8b5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482921
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-24 08:53:00 -08:00
Robert Nystrom 3ea7130e4e Restrict "prefer_initializing_formals" to avoid false positives.
When an explicit initializer or assignment is turned into an initializing formal, it's possible for that to change the semantics if there are other references to the same parameter.

For example:

```dart
// Before:
class C {
  int? x;
  C(int? x) {
    print(this.x);
    this.x = x;
  }
}

// After:
class C {
  int? x;
  C(this.x) {
    print(this.x);
  }
}
```

This prints "null" before and the argument value after.

The fix might even lead to invalid code:

```dart
// Before:
class C {
  int? x;
  int? y;

  C(int? x) : y = (x = 2) {
    this.x = x;
  }
}

// After:
class C {
  int? x;
  int? y;

  C(this.x) : y = (x = 2);
}
```

This becomes a compile error because `x` is final when it refers to an initializing formal in the initializer list.

It's also not enough to look for secondary writes inside the constructor:

```dart
// Before:
class C {
  int? x;
  Function()? closure;
  C(int? x) {
    closure = () {
      print(x);
    };
    this.x = x;
  }
}

// After:
class C {
  int? x;
  Function()? closure;
  C(this.x) {
    closure = () {
      print(x);
    };
  }
}

// Given:
main() {
  var c = C(1);
  c.x = 2;
  c.closure!();
}
```

This prints "1" before and "2" after.

I think the safest thing is to be conservative and not show the lint if there are any other references to the parameter anywhere in the constructor, even reads.

Fix #58607.

Change-Id: Ib976cd5bfc4bf44439ecd4175090dbabfe1cde16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482985
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2026-02-24 08:15:22 -08:00
Alexander Markov dc2d8a06b9 [vm,modular_aot] Lowering of type parameters
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I06098a379ba3f04b5e13bad11acc0dcc391fb30c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482364
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-02-24 06:16:51 -08:00
Daco Harkes 8852aa5c19 [analyzer/ffi] Fix analyzer crash
TEST=tests/ffi/static_checks/regress_62716_test.dart

Fixes: https://github.com/dart-lang/sdk/issues/62716
Change-Id: I8abc006cd1e7274089ea618c970aacd0bc2267e4
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-mac-release-try,analyzer-win-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,front-end-nnbd-mac-release-x64-try,front-end-nnbd-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483241
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2026-02-24 05:01:40 -08:00
Ömer Ağacan 33e6df1fe9 [dart2wasm] Print wasm-opt related options with --verbose
Change-Id: I2cdca066ffc845f94bc3fe11d4750dbdd2376953
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483260
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2026-02-24 04:26:03 -08:00
Chloe Stefantsova cf850ff4cc [cfe] Introduce CatchVariable Kernel AST node
`CatchVariable`s are supposed to be used as parameters of the `catch`
block. In the CL they are emitted under an experimental flag.

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

Change-Id: I6a486a63680fb484de7607fdebab8ba9dd975f5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482783
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2026-02-24 04:01:49 -08:00
Slava Egorov 1418cb1b9c Roll Perfetto to 49c59636465f2a32f4d83cff835538ba7bf8d732
Drop libprotobuf dependency and update compile_perfetto_protos
to rely on externally provided protoc and protozero_plugin. 
This is done because protoc does not build with our current
toolchain and fixing this build requires rolling new protobuf,
protobuf_gn and perfetto. Which also pulls more external dependencies
like abseil.

Regenerate Perfetto *.pbzero{.cc,.h}, *.dart files

TEST=ci

Change-Id: I11a32aa07e810b48ac12502e526bbaee6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482781
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-02-24 03:24:32 -08:00
Ömer Ağacan 590b656877 [dart2wasm] Update JS exception catching
This updates JS exception catching as discussed in #55481:

- Only catch JS exceptions when the exception type is `dynamic`,
  `Object`, or an extension of `JSValue`. (nullable or not)

  (Previously we also caught JS exceptions when the type is `Error`.)

- When the JS value caught in Wasm is `null` or `undefined`, box it as a
  non-interop class. For compatibility with dart2js, this class is
  copied from dart2js and has the same `toString` as the dart2js class.

- In other cases: box the JS values as `JSValue`. This means the value
  can be passed as any of the interop types, and can be passed back to
  JS without manual jsification.

Fixes #55481.

Issue: https://github.com/dart-lang/sdk/issues/55481
Change-Id: I23e73074729f740b90df2ca8b3c713fb39966556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479640
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2026-02-24 01:43:10 -08:00
Slava Egorov 33c0d4bf70 [vm/profiler] Don't give up when FP is invalid
If we have Dart stack frame information don't give up on profiler
sample if C frame is malformed due to invalid FP. We are not 
going to use C frame information anyway.

TEST=ci

Change-Id: I8da05d1397f805543b7721fa9d861a996a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-02-24 01:32:27 -08:00
Daco Harkes 23600f57df [record_use] Record record constants
Closes: https://github.com/dart-lang/native/issues/3054

TEST=pkg/compiler/test/record_use/record_use_test.dart
TEST=pkg/dart2wasm/test/record_use_test.dart
TEST=pkg/vm/test/transformations/record_use_test.dart

Change-Id: I3d35d50a90e8f409f4374c8d4a344205faf4ca52
Cq-Include-Trybots: luci.dart.try:dart2wasm-asserts-linux-chrome-try,dart2wasm-asserts-minified-linux-d8-try,dart2wasm-linux-chrome-try,dart2wasm-linux-d8-try,dart2wasm-linux-firefox-try,dart2wasm-linux-jscm-chrome-try,dart2wasm-linux-optimized-jsc-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try,dart2js-canary-linux-try,dart2js-hostasserts-linux-d8-try,dart2js-linux-chrome-try,dart2js-linux-firefox-try,dart2js-mac-chrome-try,dart2js-mac-safari-try,dart2js-minified-csp-linux-chrome-try,dart2js-minified-linux-d8-try,dart2js-unit-linux-x64-release-try,dart2js-win-chrome-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482940
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-02-24 00:31:55 -08:00
Jens Johansen a1ba5461d8 [analyzer] Bail out earlier in ElementUsageDetector
All numbers via

```
perf stat -e instructions:u out/ReleaseX64/dart-sdk/bin/dartaotruntime_product --deterministic --marker_tasks=1 --new_gen_semi_initial_size=10000 --new_gen_semi_max_size=20000 pkg/analyzer/tool/stable_analysis.aot  --silent /tmp/stable_analysis_extract
```

### Update

With https://dart-review.googlesource.com/c/sdk/+/478701 having been
reverted I've rebased and this is the new numbers:

Parent CL:

    42,708,904,561      instructions:u
    42,705,451,731      instructions:u
    42,705,714,002      instructions:u

This CL:

    42,517,120,185      instructions:u
    42,517,237,423      instructions:u
    42,514,559,436      instructions:u

Saves ~188 mio instructions

---------

### Original commit message

At parent CL:

    43,497,152,157      instructions:u
    43,496,619,753      instructions:u
    43,496,990,462      instructions:u

with this CL:

    43,114,441,607      instructions:u
    43,115,191,318      instructions:u
    43,114,584,671      instructions:u

So this saves ~381 mio instructions...

Notice that metadata is used a lot more with https://dart-review.googlesource.com/c/sdk/+/478701 which cost ~900 mio instructions.
Reverting that CL I get:

    42,696,057,264      instructions:u
    42,698,447,840      instructions:u
    42,695,543,793      instructions:u

Reverting and applying this CL I get:

    42,504,068,113      instructions:u
    42,503,699,054      instructions:u
    42,503,965,559      instructions:u

So this still saves ~191 mio instructions.

Change-Id: Ibc8ff507c0ef043a3d04f6c952001795f04938bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481801
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-02-24 00:18:21 -08:00
Jens Johansen 7d0527e0ca [analyzer] Don't create new list and new MetadataImpl when there is no metadata
All numbers via

```
perf stat -e instructions:u out/ReleaseX64/dart-sdk/bin/dartaotruntime_product --deterministic --marker_tasks=1 --new_gen_semi_initial_size=10000 --new_gen_semi_max_size=20000 pkg/analyzer/tool/stable_analysis.aot  --silent /tmp/stable_analysis_extract
```

### Update

With https://dart-review.googlesource.com/c/sdk/+/478701 having been
reverted I've rebased and this is the new numbers:

Before:

    43,147,479,541      instructions:u
    43,147,488,753      instructions:u
    43,147,472,393      instructions:u

After:

    42,708,904,561      instructions:u
    42,705,451,731      instructions:u
    42,705,714,002      instructions:u

So this CL saves ~438 mio instructions.

---------

### Original commit message

Current HEAD:
44,034,141,347      instructions:u

Current HEAD and with this CL:
43,496,513,158      instructions:u

So here it saves ~537 mio instructions.

Notice that metadata is used a lot more with https://dart-review.googlesource.com/c/sdk/+/478701 which cost ~900 mio instructions.
Reverting that CL I get:
43,134,247,808      instructions:u

Reverting and applying this CL I get:
42,695,542,548      instructions:u

So this still saves ~438 mio instructions.

Change-Id: Ie658bd5618c93518ef4b7c1370e75b57d8e2087a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481700
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 23:29:50 -08:00
Robert Nystrom 04f8618c2b Roll the latest dart_style into the SDK.
There are no actual style changes, just increasing the highest supported
version number in the formatter in anticipation of 3.12 coming out.

Change-Id: I86f7283579cc6788f153e0d41e5228fb77bd9a3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482964
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2026-02-23 23:27:03 -08:00
Robert Nystrom ea1bc24fdc ConvertToInitializingFormal: Don't discard initializers when deleting the constructor body.
ConvertToInitializingFormal can convert an initializer to an initializing formal, or an assignment statement in the body:

```dart
class C {
  int x;
  C(int x) {
    this.x = x;
  }
}
```

When converting from an assignment statement, if there are no statements left in the block, it deletes the entire function body.

Prior to this CL, it would also erroneously delete any initializers that happened to be on the constructor:

```dart
// Before:
class C {
  int? x;
  int? y;

  C(int? x) : y = 1 {
    this.x = x;
  }
}

// Result of applying fix:
class C {
  int? x;
  int? y;

  C(this.x); // Oops! Where did ": y = 1" go?
}
```

Change-Id: I5bd27e925509adc82056b71f4c96432c819bc954
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482966
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2026-02-23 18:12:59 -08:00
Konstantin Shcheglov ba9923c406 DeCo. Add ScopeContext.visitDocumentationComment
Centralize documentation comment traversal in ScopeContext so that all
declarations visit doc comments under a consistent
DocumentationCommentScope.

The new helper temporarily rebinds the doc-import scope’s inner scope to
the current name scope, assigns the comment’s nameScope, and then visits
the comment. This preserves correct resolution of identifiers referenced
from documentation comments while avoiding duplicated scope plumbing.

As part of the refactor:
- Remove per-call visitDocumentationComment overrides from ScopeContext’s
  declaration visitors.
- Delete ScopeResolverVisitor’s private _visitDocumentationComment helper
  and ScopeContext.withDocImportScope.
- Update all resolver call sites to route doc-comment visits through the
  new ScopeContext API.

Change-Id: Iffbefb03cf5f61b61144a9f3a9cfc85b4df10491
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482981
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-23 18:10:40 -08:00
Kallen Tu 62fc64513c [analysis_server] Primary constructors - Add fix for var_with_no_type_annotation.
The fix for `var_with_no_type_annotation` is to remove the `var` keyword. We'll use the `RemoveLexeme` fix to accomplish this.

Bug: https://github.com/dart-lang/sdk/issues/61704
Change-Id: I0cd3951bdb78975c059ad2beaee4c77c68fabfda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482521
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-23 16:44:11 -08:00
Paul Berry f7edf6a7f7 [flow analysis] Remove _flowAnalysisInfoMap from mini_ast test harness.
Removes the `_flowAnalysisInfoMap` field from the `Harness` class,
which serves as the test harness for the mini_ast used in flow
analysis testing, along with the methods `getFlowAnalysisInfo` and
`storeFlowAnalysisInfo` that did map lookups. Calls to
`getFlowAnalysisInfo` are replaced with logic that pulls the flow
analysis expression info directly from the expression analysis result,
and calls to `storeFlowAnalysisInfo` are dropped (since they are no
longer needed).

Also, the assertion is dropped from `dispatchExpression` that used to
verify that the information stored in the map matched the information
stored in the expression analysis result.

Change-Id: I6a6a69643e0345a1f5ef84f09340119b56bfed12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482580
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-02-23 15:54:31 -08:00
Paul Berry c116ea6c55 [flow analysis] In tests, improve plumbing of flow analysis info.
Makes the following updates to the mini_ast used for flow analysis
testing:

- When visiting a `Write` node, the flow analysis expression info is
  pulled directly from the analysis result of the RHS and passed to
  `_visitWrite`, rather than deferring to `_visitWrite` to look it up
  using `getFlowAnalysisInfo`.

- When computing the promoted type or the promotion chain of a
  `Property` node, the flow analysis expression info is pulled
  directly from the analysis result of the target (by
  `_computeMemberAndFlowAnalysisInfo`) rather than looking it up using
  `getFlowAnalysisInfo`.

- When creating the guard variable for a null-aware property access or
  method call, the result of analyzing the target is passed directly
  to `createNullAwareGuard`, allowing it to obtain the flow analysis
  expression info directly rather than fetching it from
  `getFlowAnalysisInfo`. The modified expression info for the
  null-checked target is then returned directly back to the caller
  using another analysis result, rather than requiring the caller to
  look it up using another call to `getFlowAnalysisInfo`.

These changes pave the way for removing the `getFlowAnalysisInfo` and
`storeFlowAnalysisInfo` methods from mini_ast, along with the map they
use for storage.

Change-Id: I6a6a6964d4533c16f622f08b302a7f62c959b58f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482562
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-02-23 15:46:37 -08:00
Konstantin Shcheglov bf5756b5a0 DeCo. Give LocalScope and FormalParameterScope instance of FeatureSet.
Thread the library FeatureSet into LocalScope and FormalParameterScope
so wildcard handling can be decided directly from the active language
features.

This removes reliance on per-element `isWildcardVariable` checks (which
require digging through element/library state) and centralizes the
`wildcard_variables` gate in scope construction and mutation.

Also:
- Drop the now-unneeded nullable `Element?.isWildcardVariable` helper.
- Remove the extensions import from scope.dart and add lightweight
  assertions around LocalScope inputs.

Change-Id: I3a0f2e0528464c48a0b944590eb4dcee918a12e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482982
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-23 15:33:59 -08:00
Konstantin Shcheglov baa6cd6eb9 DeCo. Add Scope.visitEnumDeclaration / visitClassTypeAlias
Introduce ScopeContext.visitEnumDeclaration and visitClassTypeAlias to
centralize the standard scoping/visitation order for these declarations,
including type-parameter scope, instance scope, and documentation
comment handling.

Refactor ResolutionVisitor, ScopeResolverVisitor, and ReferenceResolver
to use the new helpers, reducing duplicated scope plumbing and keeping
the three resolver phases consistent.

Fix enum primary-constructor formal parameters being visited outside the
body scope, which could resolve annotations and type names against the
library scope rather than enum members (for example, when static members
shadow outer names).

Change-Id: I2ea8335ac6a225a13b5498ffda0a0bcb1ac9b889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482961
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-23 15:31:51 -08:00
Brian Quinlan 948ad371bf [deps] rev ai, core, ecosystem, http, i18n, protobuf, shelf, test, tools, vector_math, web, webdriver
Change-Id: I47c1ce111b3bdc3543def81b1fee5333f2df485a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483040
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-02-23 15:13:31 -08:00
DEPS Autoroller 7b7cc5142a Roll Fuchsia SDK from 31.20260219.3.1 to 31.20260220.4.1
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-sdk-dart-sdk
Please CC fuchsia-3p-engprod@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Fuchsia SDK: https://bugs.fuchsia.dev/p/fuchsia/issues/list
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try;luci.dart.try:vm-fuchsia-release-arm64-try
Change-Id: Id6f078da09f85ae03b9a91dde6c2220d27222f16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482400
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2026-02-23 14:39:31 -08:00
Paul Berry 05dc1ccbb7 [flow analysis] Refactor unit tests to use their own expression info map.
Migrates the mini_ast used for flow analysis testing so that instead
of associating expressions with expression info objects using
`FlowAnalysis.getExpressionInfo` and
`FlowAnalysis.storeExpressionInfo`, it does so using its own private
map, which it accesses using the new methods `getFlowAnalysisInfo` and
`storeFlowAnalysisInfo`.

This paves the way for two independent arcs of work:

- Removing the `getExpressionInfo` and `storeExpressionInfo` methods
  from `FlowAnalysis`.

- Simplifying mini_ast so that it tracks expression info objects using
  `ExpressionTypeAnalysisResult.flowAnalysisInfo` rather than its own
  private map.

A similar effort is underway for the analyzer and front_end, which
should carry the following benefits:

- It will make type analysis more performant by avoiding map lookups

- It will decrease the risk of subtle bugs when one expression is
  changed into another.

Change-Id: I6a6a6964f0c41c62be21efc0fa16b22b10e85b34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482561
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2026-02-23 14:28:22 -08:00
Ryan Macnak 60fe67bb4b [vm] Let the C++ compiler know it can assume the low bit of a Smi is clear.
TEST=ci
Change-Id: I89f60532a6fe7923a5d4d7bbcd624228ab899854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481300
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-23 13:01:19 -08:00
Alexander Aprelev 0c3771aaee Revert "Roll BoringSSL from 9a74210911fd to 6a584e1d58d1 (7 revisions)"
This reverts commit 35ff7a4bb7 because it
breaks dart->flutter roll. https://github.com/flutter/flutter/issues/182781 tracks flutter update.

Change-Id: Ie78544777ea6b5e08b263e0a77adf305639dac5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482962
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2026-02-23 12:14:30 -08:00
Konstantin Shcheglov bd9c3a03ba AI. Add read_gerrit_cl skill.
Change-Id: I70da1371c01d442511e32f8d35e6106cf4db2af7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481320
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-23 11:39:41 -08:00
Sam Rawlins f5949231ce analyzer: add note about new mustBeConst tear-off warning
Change-Id: Ibdb8708bf882f84211b4b61487204971c412b234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2026-02-23 11:04:18 -08:00
Sam Rawlins 7143390ba0 DAS plugins: add changelog note regarding excluded files
Fixed in https://dart-review.googlesource.com/c/sdk/+/482460

Change-Id: I57667f948cf9af40b88dc98f8983bff881487933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482960
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-23 11:02:35 -08:00
Erik Ernst 0ec34ebde6 Mark the ..obvious.. lints as having state: stable
This CL changes the `state:` field of the lint documentation records in
pkg/linter/messages.yaml from `experimental` to `stable`.

The CL https://dart-review.googlesource.com/c/sdk/+/479841 was intended
to change the status, and it did remove a paragraph from the
documentation about the lints being experimental, but it was complete in
that it did not change the `state:` fields.

Change-Id: I986dfc28dc6a6943c760cbe129ee619d8162a613
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482785
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-02-23 10:34:52 -08:00
Konstantin Shcheglov 51cdf271de DeCo. Report diag.duplicateDefinition for defining formal parameters with name '_'.
Change-Id: I6c8d9cbacb78efb17fd5b8603263deb3d65e6335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482660
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 10:23:15 -08:00
Ryan Macnak e443b89f23 [vm] Update Irregexp to V8 commit 254cc758346f10be2a7e22e55d90d4defe9cad74.
Includes support for modifier spans and duplicate named capture groups.

Drops the flow graph implementation to ease maintenance.

TEST=corelib/regexp
Bug: https://github.com/dart-lang/sdk/issues/56573
Bug: https://github.com/dart-lang/sdk/issues/61337
Bug: https://github.com/dart-lang/sdk/issues/62349
Bug: https://github.com/dart-lang/sdk/issues/62708
Change-Id: I05640ba945a4fa5476e7ad463738f4f39d842c14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480121
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-23 09:54:47 -08:00
Sam Rawlins 5b44ac37e5 linter: Support extension types in unreachable_from_main
Work towards https://github.com/dart-lang/sdk/issues/58838

Change-Id: I0964ca3d78dde02507672b517671b63444f68891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-02-23 09:49:59 -08:00
FMorschel 1f8861f4f9 [analyzer_plugin] Fixes recursive type writing on DartEditBuilder.writeType
Fixes: https://github.com/dart-lang/sdk/issues/62549
Change-Id: Ia5f8b7cf7f923d63a73a9b155d1590052a61eaa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476800
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-23 09:06:48 -08:00
Konstantin Shcheglov 94c31ded4a DeCo. Extract visitClassDeclaration, visitExtensionDeclaration, visitExtensionTypeDeclaration into ScopeContext.
Change-Id: Ic9c15bfe66326625a91b1cc813204251b6eb36a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482620
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 08:55:45 -08:00