Commit Graph

111894 Commits

Author SHA1 Message Date
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
Sam Rawlins 265b75c74e linter: leak_detectors: fix case for method invocation with no target
Fixes new failures in flutter bot: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8689087561632725585/+/u/analyze_Flutter_repositories/stdout?format=raw

Regression introduced by https://dart-review.googlesource.com/c/sdk/+/482444

The bug was that we bailed out too early, when looking at a method
invocation, and we are deciding whether it might represent a valid
cancelation. There are some checks that are only valid if the invocation
has a real target. But there are other checks that should be made even
if the function has an implicit target.

Change-Id: Id67d381aa1f78de8bf0f264a962ee2bbbdc6a030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-02-23 08:49:29 -08:00
FMorschel e8df76286e [analysis_server_plugin] Skips files that are analyzer excluded.
Fixes: https://github.com/dart-lang/sdk/issues/62729
Change-Id: I4b60ad02b10009decfa091d8dce84a0e765a7b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482460
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-23 08:27:38 -08:00
Konstantin Shcheglov f2de280b40 DeCo. Report initializingFormalForNonExistentField for primary constructors.
Change-Id: I42d2516902a0d7c2a3eb914d39afe01a10d4bf86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 08:12:48 -08:00
Konstantin Shcheglov b18b1c598a CQ. Remove FeatureSets.latestWithVariance, already included in latestWithExperiments.
Change-Id: Ibb914ca13048a2734426d1e89efe1d13eafe4fb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482680
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 08:11:38 -08:00
Alexander Markov ba4bfeabda [vm,modular_aot] Support getter and setter selector names
Add 'get:' and 'set:' prefixes to getter and setter selectors.

Also revise snapshot serialization of private names to support
private getter and setter names. ast.Name is replaced with
VM-specific PrivateName as private getter/setter names
such as get:_foo are considered public by ast.Name
(as they don't start with '_').

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I7447cb457aa2463836c8cf6af3d12e1998fe325c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481441
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-02-23 08:07:29 -08:00
Alexander Markov 7eb7da6890 [vm,modular_aot] Initial code generation for interface calls
Also:
* Support arguments descriptors.
* Fix order of ClosureCall inputs in local function invocations.
* Fix order of passing arguments in all Dart calls.
* Fix handling of fields in InstanceSerializationCluster.
* Do not compile abstract methods and fields.
* Do not generate initializer functions for fields with trivial
  initializers.
* Initialize Code::code_source_map to an empty CodeSourceMap
  (in order to avoid failed assertions).

TEST=tools/test.py -n vm-modaot-mac-debug-arm64 language

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I40ff1b8234c32c41e08f3288a23e4abc173efcfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480020
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-02-23 08:03:48 -08:00
Konstantin Shcheglov 7f32691a95 CQ. Make ErrorVerifier._featureSet non-nullable.
Change-Id: I14db847fda69f6fd690b02290d71600e237d2373
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482700
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 07:59:51 -08:00
Konstantin Shcheglov 45ab768bf5 DeCo. Pass LocalScope to ScopeContext.withLocalScope
Change ScopeContext.withLocalScope to pass the created LocalScope to the
callback, and add LocalScope helpers for bulk insertion of declared
elements.

Refactor resolution/scoping visitors to use the provided LocalScope
rather than downcasting nameScope or relying on ad-hoc predeclaration:
- Predeclare local functions, local variables, and pattern variables in the
  correct enclosing scope before visiting initializers/bodies, so lexical
  lookup binds to loop/local elements consistently (including in implicit
  block scopes for control-flow sub-statements).
- Centralize for-loop-parts handling (declarations, identifiers, patterns)
  so each part is visited in the required order while installing the right
  loop-local bindings.
- Compute and store declared pattern-variable elements directly on the
  relevant AST nodes, and update ForEachPartsWithPattern to carry variable
  elements (so flow analysis can declare them without extra indirection).

Also ensure metadata on pattern variable declarations and pattern-for
parts is visited in the same scope model as other declarations.

Change-Id: I35d52860b6816196085d79979cda861583c850be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482540
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 07:58:34 -08:00
Danny Tuppeny 2a375317f4 [analysis_server] Deprecate HighlightRegionType.BUILT_IN and always use KEYWORD
Change-Id: I86ff7edc2b4de5910b19f6bdb0d4422b7546897a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482820
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-23 07:44:32 -08:00
Alexander Markov 39c5a61f89 [vm] Check covariance of type parameters of a forwarding stub instead of its target
A forwarding stub can have a covariant type parameter while the same
type parameter in its forwarding stub target is non-covariant.

We should still check bounds of such type parameters
(the bound to check is taken from the forwarding stub target).

TEST=tests/language/regress/regress62664_test.dart
Fixes https://github.com/dart-lang/sdk/issues/62664

Change-Id: I86eeb9f8a537c22fb473388f9b17f55084af6366
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482480
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-02-23 07:27:56 -08:00
Daco Harkes 2ec10d2611 [deps] Roll dart-lang/native
Rolls in support for enum consts and record consts, but doesn't
start using them yet.

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: Ia161e41e401b051a59976be6225570a6c2dd09ad
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/+/482800
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-02-23 06:28:15 -08:00
Daco Harkes dc07f70956 [record_use] Const instance recording classes must be final
And they may not be extended, implemented and mixed in.

It would be cleaner if we test the static checks with the [cfe]
test expectations. However, those test suites are not set up to
run from a package context, which `@RecordUse` annotations must be.

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: Ia4e93a6f25ad4c246503ebf8ece67e7d4bca1410
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/+/482220
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-02-23 04:15:43 -08:00
Daco Harkes 86880a4cab [cfe/ffi] Don't transform methods if wrong number of arguments
TEST=tests/ffi/static_checks/regress_62693_test.dart

Closes: https://github.com/dart-lang/sdk/issues/62693
Change-Id: Ifa9228568a4b01f162df727f80cbb923d148d043
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/+/482760
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-02-23 03:50:41 -08:00
Tess Strickland 5792b6ecb7 [vm, dyn_modules] Fix tracing the original instruction at breakpoints.
https://dart-review.googlesource.com/c/sdk/+/481782 removed the tracing
of the original instruction for breakpoints. This CL adds it back.

Also increments icount_ before calling TraceInstruction in the dispatch
loop instead of afterwards so that breakpoint/single step tracing can
just use icount_ without adjusting it. In particular, this means tracing
the original instruction at a breakpoint can just use TraceInstruction
instead of duplicating it.

Also, now both the breakpoint instruction and the original instruction
are written to the instruction trace if requested, instead of only the
breakpoint instruction.

TEST=debugging only changes, so manually tested.

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: I1999f1d9e7ba55b950c508e848ff12db0c8d5cab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482320
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2026-02-23 03:45:57 -08:00
Lasse R.H. Nielsen ced356c76e Use private named parameters in the core libraries.
CoreLibraryReviewExempt: No API or implementation changes.
Change-Id: I056ddf937f9010979cbf4c99b8802a8c43ab5e5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481820
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2026-02-23 03:06:51 -08:00
gurusai-voleti 138eaad8cb chore: Migrate gsutil usage to gcloud storage
Closes https://github.com/dart-lang/sdk/pull/62727

GitOrigin-RevId: 05bd7ecca1d5b6a9a0faf97b14ccb7d5966fe949
Change-Id: I3f8c3a3c62cd489864fc6928e6281da0ce465f8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482041
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2026-02-23 02:07:01 -08:00
Sergey G. Grekhov 6ee27dcaba [co19] Roll co19 to 506c0dea4875bc96004c28776fbd283aa5c92f7d
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3182. Add tests for override inference (dart-lang/co19#3627)
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3182. Update constructors test according to the new rules for `_` (dart-lang/co19#3624)
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3182. Update functions test according to the new rules for `_` (dart-lang/co19#3625)
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3182.Add tests for external js interop functions (dart-lang/co19#3620)
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3182. Add tests for augmentation of primary constructors. Part 3. (dart-lang/co19#3615)
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3315. Add tests for wildcarded parameters (dart-lang/co19#3623)
2026-02-20 sgrekhov22@gmail.com dart-lang/co19#3182.Add tests for external js interop classes, constructors and extensions (dart-lang/co19#3622)
2026-02-17 sgrekhov22@gmail.com Fixes dart-lang/co19#3618. Use `@dart=3.11` for old test for private parameter name (dart-lang/co19#3619)

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

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try
Change-Id: I72000f19ce8f0270567e85344b7b82e13481eaac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482740
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2026-02-23 02:03:47 -08:00
Martin Kustermann f99f5b1a2b [dart2wasm] Allow marking functions as pure functions
If a function doesn't have an effect we can now mark it via
`@pragma('wasm:pure-function')`. We'll then emit this as metadata
in the `binaryen.remove.if.unused` custom section.

This allows `wasm-opt` to remove calls to such functions if the result
of the call isn't used.

For now we mark a few string functions as pure.

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

Change-Id: I8d38fb5894fd98248dc4d648d99c8cdcddc271a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481802
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2026-02-23 01:39:37 -08:00
dependabot[bot] 18816329f6 Bump the github-actions group with 5 updates
Closes https://github.com/dart-lang/sdk/pull/62566

GitOrigin-RevId: 02800a7ef19853ed6f718874d0c1082c2fe9aaea
Change-Id: I0dd8b4cae787fb8036caf81d4db06218815cb879
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477240
Reviewed-by: Alexander Thomas <athom@google.com>
2026-02-23 00:15:07 -08:00
Paul Berry d3c0a3768b [flow_analysis] Refactor unit tests to use explicit PreIncDec node.
Previously, the mini_ast used for flow analysis testing simulated
prefix increment/decrement operations using a `Write` node with a
null right-hand side. This commit introduces a dedicated `PreIncDec`
node to represent these operations more accurately.

The test "write() permits expression to be null" is removed in favor
of two new tests:
- "preIncDec() stores expressionInfo in the write"
- "preIncDec() demotes to the written type"

These new tests parallel the corresponding tests that already exist
for postIncDec.

Change-Id: I6a6a69646c63ca1c605272d4170eae3729ce90e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-02-21 11:11:14 -08:00
Paul Berry d85e573e74 [flow analysis] Simplify handling of post increment/decrement.
This change makes two changes to how flow analysis works for post
increment/decrement operations.

Firstly, in the anaylzer implementation, the check against
`inference_update_4` is removed. Previously, the analyzer called
`FlowAnalysis.postIncDec` when `inference_update_4` was enabled, and
`FlowAnalysis.write` when it was disabled. This was unnecessary, since
that language feature had no effect on the flow analysis of post
increment/decrement. Furthermore, it was a violation of separation of
concerns, because even if that language feature _had_ had an effect on
the flow analysis of post increment/decrement, it would have been the
job of flow analysis to implement that effect, not the
client. Fortunately, `FlowAnalysis.write` happens to have the same
behavior as `FlowAnalysis.postIncDec` when `inference_update_4` is
disabled, so there is no behavioral change; this is purely a clean-up.

Secondly, the return type of `FlowAnalysis.postIncDec` is changed from
`ExpressionInfo?` to `void`, and the calls to `storeExpressionInfo`
are removed from call sites. Previously, `FlowAnalysis.postIncDec`
always returned `null`, so again, there is no behavioral change.

Note that these changes do not affect the front_end in any way, since
it de-sugars `x++` and `x--` to equivalent "let" expressions before
invoking flow analysis. Those let expressions, fortunately, have the
same flow analysis effect as `FlowAnalysis.postIncDec`. Thanks to the
test added in https://dart-review.googlesource.com/c/sdk/+/482342, we
have enough language test coverage to confirm this.

Change-Id: I6a6a6964253394c71e6bc72d801d9044b1b1ae30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482541
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-02-21 11:00:44 -08:00
Paul Berry d0278ea7b8 [flow analysis] Test post increment/decrement demotion.
Adds a language test and a flow analysis unit test to cover a flow
analysis behavior of post-increment and post-decrement operators that
wasn't previously covered.

The tests verify that the expressions `x++` and `x--` demote `x` in
the same way that `x = x + 1` and `x = x - 1` would. This demotion is
only user-visible if the type of `x` is a user-defined type.

In the process of writing these tests, I noticed that the "mini-AST"
implementation of post-increment (which is used solely for flow
analysis unit testing) was not correct; it presumed that the type read
from the target, the type written to it, and the type of the whole
expression were all the same. This is not correct; the type written to
the target is determined by the return type of the `+` operator. I've
fixed this as part of this CL so that the unit test properly exercises
flow analysis.

I will follow this up with some refactoring of how flow analysis
handles post increment/decrement operations. Landing the test first
allows us to be confident that the refactor won't change the tested
behavior.

Change-Id: I6a6a6964417b48db0c1681c06d7418bd79e96357
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482342
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-02-21 10:59:44 -08:00
Konstantin Shcheglov 5cbe70416f Start analyzer 10.3.0-dev, analyzer_plugin 0.14.5-dev, analyzer_testing 0.2.2-dev, analysis_server_plugin 0.3.11-dev
Change-Id: I5fecb1813aebf0be764f41f270ae26a0de4dcc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482600
Reviewed-by: Paul Berry <paulberry@google.com>
2026-02-21 10:52:57 -08:00
Sam Rawlins c8503df1dd linter: Support extension types in leak-detector rules
Work towards https://github.com/dart-lang/sdk/issues/58838

Change-Id: I5d2128785da6e0923308bc5d136d67088ac2118c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482444
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-02-21 07:42:59 -08:00
Erik Ernst c4fdf45799 Add void usage check to visitAnonymousMethodInvocation
This is a tiny bug fix: The `e1.=> e2` analysis failed to check that it
is an error for `e1` to have type `void`.

Change-Id: I88b505ab7d95baf13bb272034941aa88cda2cb11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482242
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2026-02-21 02:32:30 -08:00
Brian Wilkerson cdd8ca2dcc Add an assist to convert a non-declaring parameter into a declaring parameter
This handles the most of the cases I could think of. Please review with
an eye toward catching holes. I also left a couple of questions in the
tests as there are a couple of cases I wasn't sure we wanted to support.

This doesn't handle fields with an initializer, though I think we could.
If you think we ought to handle it before shipping the feature I can either
update this CL or do it in a follow-on.

Change-Id: Ia9ac5d86853bc907fdce10e31f03714eeb89f1af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481621
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-20 17:13:49 -08:00
Srujan Gaddam 29af7aa641 Clarify scope of breaking change of isA
https://github.com/dart-lang/sdk/commit/9f367b170941868927e4c1fad3f6f629c1ba52fb
is only breaking if the user referred to the extension
names directly, so we should clarify that in the changelog.

Change-Id: Ibaff9227dc9ffd0bbd7c2e7cd21e7bd9da124204
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482081
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
2026-02-20 17:02:28 -08:00
Kallen Tu 6005ca0cf7 [tests] Primary constructors - Wildcards, assignment, initializing formals.
Tests the following:
- A compile-time error occurs if an assignment to a primary parameter
occurs in the initializing expression of a non-late instance variable.
- A compile-time error occurs if a declaration has a primary constructor
with an initializing formal and no instance variable of the same name.
- Declaring parameters named `_` cannot be declared multiple times in a primary constructor.
- Wildcard variables cannot be referenced in the initializing
expressions of non-late instance variables or in the initializer list of
the body part of the primary constructor.
- Declaring parameters named `_` are allowed. Accessing `_` is valid in
the body part of a primary constructor if there's an instance variable
with the name `_`.

Bug: https://github.com/dart-lang/language/issues/4634, https://github.com/dart-lang/sdk/issues/61687
Change-Id: Id2cb98bd78e31292894610b595174fa682bdc1ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481321
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-02-20 16:03:44 -08:00
Konstantin Shcheglov 777b6efcd9 Prepare to publish analyzer 10.2.0, _fe_analyzer_shared 96.0.0, analysis_server_plugin 0.3.10, analyzer_plugin 0.14.4, analyzer_testing 0.2.1
Change-Id: Id5f874b59e441c81910d979d9f50e4415674179d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482363
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-02-20 12:59:46 -08:00
Paul Berry dc0d3e82e9 [API summary] Create a customization mechanism.
The customization mechanism provides the following pieces of
functionality:

- Allows access to the package name, the analysis context, the list of
  public API libraries, and the set of top level public API elements.

- Allows customizing the logic for deciding which top level elements
  to show details about.

- Provides hooks to allow additional code to be executed after setup
  and after the initial scan.

This customization mechanism is used when generating
`pkg/analyzer/api.txt` to recognize that any element annotated with
`@AnalyzerPublicApi` should have details shown, even if it is not
exported in any analyzer public library.

The class used to perform customization, `ApiSummaryCustomizer`, is
marked `base` so that we can add additional hooks in the future
without breaking clients.

With this change, the API summary tool no longer has any hard-coded
analyzer-specific functionality.

Change-Id: I6a6a6964fcc626db8e8e387c306fc1ff03fbc0a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-02-20 11:59:21 -08:00
Nate Biggs 1fc8f6e988 [dart2wasm] Fix missing cases in deferred loading fine grained dependency calculation.
- The dependencies of a class should also include the initializers for its fields. These are used to initialize the class object. And they are not represented in the constructor Initializers list.
- Super gets/sets/invocations should all visit their children as well. These aren't leaf nodes.

Change-Id: I552bc87cf1bbc35b11b0dd7bcbd167b2fa5bcbe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481680
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-02-20 11:53:17 -08:00
Paul Berry dca8eb4ae6 [API summary] Consider publicly exported names to be part of public API.
Changes the logic for deciding whether to output details about a top
level element. Previously, details would be output if the library
containing the element's declaration was in `lib` but not
`lib/src`. This led to a bug: if a top level element was declared in
`lib/src` but exported by an `export` directive in `lib`, no details
would be output, and the API summary would just show `(non-public)`
after the exported name.

This bug was mostly benign because we were working around it with an
analyzer-specific hack: when analyzing the `analyzer` package, top
level elements with an annotation of type `AnalyzerPublicApi` would
have their details output regardless of where they were declared. But
it wasn't completely benign: the tool was failing to output details of
`DartDocumentLinkVisitor` and `DocumentLink` (from
`package:analyzer_plugin`), as well as `PackageBuilder` (from
`package:analyzer_testing`).

The new logic is: details are output if the element appears in the
export namespace of any library in `lib` but not `lib/src`. I've
re-run the API summary tool so the `api.txt` files in
`package:analyzer_plugin` and `package:analyzer_testing` now include
the details they were missing.

The analyzer-specific hack is left in place, though, because there are
some analyzer classes that aren't exported, but still considered part
of the analyzer public API. In a follow-up CL, I will make the API
summary tool extensible so that this analyzer-specific logic can be
injected by the analyzer when generating its `api.txt` file, and it
won't pollute the incipient `api_summary` tool.

Change-Id: I6a6a69641d656caa4f8e6361557c13fa7485e422
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-02-20 11:21:15 -08:00
Konstantin Shcheglov bdfede5b08 DeCo. Centralize resolver scope helpers in ScopeContext.
Expand ScopeContext into the single place that manages resolver
name-scope transitions, and migrate visitors to use it directly.

ScopeContext now:
- Owns the current name scope and handles push/pop via withScope().
- Provides focused helpers for common resolver scopes:
  - withLocalScope(), withInstanceScope(), withExtensionScope()
  - withTypeParameterScope() and withTypeParameterList()
  - withFormalParameterScope()
  - withConstructorInitializerScope() and withPrimaryParameterScope()
  - withDocImportScope() for documentation comment resolution
- Renames walkMixinDeclarationScopes() to visitMixinDeclaration() and routes
  mixin traversal through the shared helper.

Update ResolutionVisitor, ScopeResolverVisitor, and ReferenceResolver

to:
- Remove temporary routing getters/methods and ad-hoc try/finally scope
  management.
- Use the new ScopeContext helpers for consistent scoping across declarations,
  function bodies, and DeCo/primary-constructor-related initializer contexts.
- Reduce duplicated scope wiring and keep scope behavior localized for easier
  future evolution.

This is reland of https://dart-review.googlesource.com/c/sdk/+/481981 with support for ScopeResolverVisitor.visitAnonymousMethodInvocation, see PS(s).

Change-Id: Ieee6c732872fc32af86710237972cd7397ca54dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482365
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-20 11:18:28 -08:00
Paul Berry c6a9c9536e [api_summary] Add class modifier support.
Adds the modifiers `abstract`, `base`, `final`, and `interface` to the
API summary output.

This information is an important part of the public API of a package,
because it determines whether a client can:

- Construct an instance of the class,
- Extend the class, or
- Implement the class.

Change-Id: I6a6a6964ba07db1714bc2fcb549cc15230e87058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-02-20 10:49:45 -08:00
Paul Berry 02ced6c1a5 [api_summary] Fix member sort order.
Fixes two minor bugs with the sorting of members in the API summary
tool:

- The technique for placing getters next to their corresponding
  setters was to sort them lexicographically based on
  `Element.apiName`, which in the case of setters appends `=`. This
  mostly worked, but due to the fact that `=` is between `9` and `A`
  in ASCII, it was wrong in a few corner cases. For example, it would
  sort `x`, `x=`, `x1`, and `x1=` in the order `x`, `x1`, `x1=`,
  `x=`. Fixing this didn't affect any `api.txt` files in practice.

- The technique for sorting constructors also used `Element.apiName`,
  which in the case of an unnamed constructor is `new`. This meant
  that if a class had both named and unnamed constructors, the unnamed
  constructor would not always be sorted before the other
  constructors.

The fix for both bugs is to sort by `Element.name` (which does not add
`=` for setters and is the empty string for unnamed constructors), and
then to break ties by explicitly checking whether the element is a
setter.

Change-Id: I6a6a69648fb5915266a9111c5d884531bba4405d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-02-20 10:43:16 -08:00
Paul Berry 016ea28ede [api_summary] Add unit tests.
These tests cover all the functionality of the API summary tool.

Note that since the `ApiDescription` constructor requires an
`AnalysisContext`, I added a public `contextCollection` getter to the
`PubPackageResolutionTest` base class.

There are a few loose ends I intend to address in follow-up CLs. They
have been noted in TODO comments:

- Annotate when classes are `abstract`, `final`, or `interface`.

- Move `pub_package_resolution.dart` out of
  `package:analyzer_testing/src` (so that when I publish this as a
  separate package, that package won't be dependent on private
  implementation details of `package:analyzer_testing`).

Change-Id: I6a6a69643064115997f6586ff5161ddf4c9f96ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-20 10:41:40 -08:00
Konstantin Shcheglov 85cf042a24 Revert "DeCo. Centralize resolver scope helpers in ScopeContext."
This reverts commit e730a62688.

Reason for revert: logical merge conflict with https://dart-review.googlesource.com/c/sdk/+/480840

Original change's description:
> DeCo. Centralize resolver scope helpers in ScopeContext.
>
> Expand ScopeContext into the single place that manages resolver
> name-scope transitions, and migrate visitors to use it directly.
>
> ScopeContext now:
> - Owns the current name scope and handles push/pop via withScope().
> - Provides focused helpers for common resolver scopes:
>   - withLocalScope(), withInstanceScope(), withExtensionScope()
>   - withTypeParameterScope() and withTypeParameterList()
>   - withFormalParameterScope()
>   - withConstructorInitializerScope() and withPrimaryParameterScope()
>   - withDocImportScope() for documentation comment resolution
> - Renames walkMixinDeclarationScopes() to visitMixinDeclaration() and routes
>   mixin traversal through the shared helper.
>
> Update ResolutionVisitor, ScopeResolverVisitor, and ReferenceResolver
> to:
> - Remove temporary routing getters/methods and ad-hoc try/finally scope
>   management.
> - Use the new ScopeContext helpers for consistent scoping across declarations,
>   function bodies, and DeCo/primary-constructor-related initializer contexts.
> - Reduce duplicated scope wiring and keep scope behavior localized for easier
>   future evolution.
>
> Change-Id: I753cccc4ed14b4b7c4f34f9c91f5d00895f84c5f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481981
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I3515e2d6dba5a49082a8a0496a283706e4cfd48c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482441
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2026-02-20 10:27:22 -08:00
Sam Rawlins 68d39a3b0d DAS insights: Only display library cycles with more than one library
Work towards https://github.com/dart-lang/sdk/issues/62724

Change-Id: I56247b71a6262bb9edc997e93e60abdd18f58b36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-02-20 10:01:23 -08:00
Konstantin Shcheglov e730a62688 DeCo. Centralize resolver scope helpers in ScopeContext.
Expand ScopeContext into the single place that manages resolver
name-scope transitions, and migrate visitors to use it directly.

ScopeContext now:
- Owns the current name scope and handles push/pop via withScope().
- Provides focused helpers for common resolver scopes:
  - withLocalScope(), withInstanceScope(), withExtensionScope()
  - withTypeParameterScope() and withTypeParameterList()
  - withFormalParameterScope()
  - withConstructorInitializerScope() and withPrimaryParameterScope()
  - withDocImportScope() for documentation comment resolution
- Renames walkMixinDeclarationScopes() to visitMixinDeclaration() and routes
  mixin traversal through the shared helper.

Update ResolutionVisitor, ScopeResolverVisitor, and ReferenceResolver
to:
- Remove temporary routing getters/methods and ad-hoc try/finally scope
  management.
- Use the new ScopeContext helpers for consistent scoping across declarations,
  function bodies, and DeCo/primary-constructor-related initializer contexts.
- Reduce duplicated scope wiring and keep scope behavior localized for easier
  future evolution.

Change-Id: I753cccc4ed14b4b7c4f34f9c91f5d00895f84c5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481981
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-02-20 09:47:31 -08:00
Kallen Tu 386a147b58 [linter] Primary constructors - Add lint 'var_with_no_type_annotation'
This new lint fires when a formal parameter is declared with `var` and
no type annotation.

We're adding this lint to ease the migration for when primary
constructors is enabled. Adding a quick-fix for this lint will come in a
follow-up CL.

Tests:
- Class methods, extension methods, extension type methods, mixin
methods, constructors, setters, functions
- Initializing formals
- Super parameters
- Function typed parameters
- Named parameters, positional parameters, optional parameters, required
parameters,

Bug: https://github.com/dart-lang/sdk/issues/61591
Change-Id: Ib09c87e234cde4be024af0b9d8a1e3e0a371e777
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481620
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-20 09:34:45 -08:00
Kallen Tu 6b79420b4c [tests] Primary constructors - Var usage in function-typed initializing formals, super, and typedefs.
Added a few tests for typedefs, function-typed initializing formals, and function-typed super parameters, and using `var` in a parameter of a function type.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: Icb234b5ee14c239219fd6b4503ae8848731fffcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482082
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-02-20 09:29:36 -08:00
Kallen Tu 14ae04c79b [tests] Primary constructors - Late and external tests.
Removing `late_external_test` since it's not testing anything new to primary constructors and the d2js/ddc errors already have test coverage.

Separating the late and external error tests (for the keyword in the header) so that we can make sure both errors are being reported.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: I6dff4c47ad07a7b0149316a6831793db162f392e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482040
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-02-20 09:26:42 -08:00
Konstantin Shcheglov 78435baf28 CQ. Update AST visitor generator to add @Deprecated on RuleVisitorRegistry methods.
Change-Id: Id2f958844f79a29b379dc8794b2a258491d47a11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481982
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-20 09:21:32 -08:00
Paul Berry 82c3e414f3 [api_summary] Split the "API summary" tool into several files.
This change splits the file `pkg/analyzer_utilities/lib/tool/api.dart`
into several files:

- `api_description.dart`, which contains the `ApiDescription` class
  that does the bulk of the work.

- `extensions.dart`, which contains utility extensions.

- `member_sorting.dart`, which encapsulates information about how to
  sort members.

- `node.dart`, which defines the tree data structure that is used to
  build the output.

- `unique_namer.dart`, which defines the logic for disambiguating
  elements that have the same name.

- `uri_sorting.dart`, which encapsulates information about how to sort
  URIs.

- `summarize_package.dart`, which contains the code for driving the
  `ApiDescription` class.

This is in preparation for extracting this logic from
`analyzer_utilities` and releasing them as a separate pub package
called `api_summary`, so that they can be used by other
projects. Accordingly, I've placed all of these files in their own
directory, `pkg/analyzer_utilities/lib/src/api_summary`. The files
that will eventually wind up in `package:api_summary/src` are in
`pkg/analyzer_utilities/lib/src/api_summary/src`.

(Under ordinary circumstances it would be strange to have a `src`
directory nested inside another `src` directory, but I believe that in
this case it's justified, since it allows us to see which files will
eventually end up in the public API of the `api_summary` package and
which will not.)

I still want to do some final polishing of the tool before publishing
it as its own package:

- Adding unit tests

- Fixing a few bugs

- Generalizing some behaviors that currently only make sense when
  analyzing the `analyzer` package.

I intend to do this polishing in follow-up CLs. Then, once the
`api_summary` package is published, I will import the package into the
SDK and remove all the files in
`pkg/analyzer_utilities/lib/src/api_summary`.

Change-Id: I6a6a6964a5f71a732bbee0bfcdcec9458737d703
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482101
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-20 09:15:29 -08:00
Konstantin Shcheglov 0b55779485 CQ. Add InternalSuperFormalParameterElement.
Introduce `InternalSuperFormalParameterElement` to unify
analyzer-internal handling of super-formal parameters across base and
substituted element implementations.

This refactor:
- Adds an internal mixin that exposes typed `baseElement`, fragments, and
  `superConstructorParameter` accessors.
- Updates `SuperFormalParameterElementImpl` and
  `SubstitutedSuperFormalParameterElementImpl` to mix it in, so internal
  code can reliably identify super-formal parameters via a single type
  check.
- Adjusts constant evaluation to collect implicit super-formal argument
  values using the internal mixin and `FormalParameterElementImpl` keys,
  ensuring the mapped values align with the super constructor’s base
  parameters.

Change-Id: If898ffd2fe24a88f60e5b775ccbd3fe8ff9f7186
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482060
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-20 09:11:30 -08:00
DEPS Autoroller 35ff7a4bb7 Roll BoringSSL from 9a74210911fd to 6a584e1d58d1 (7 revisions)
https://boringssl.googlesource.com/boringssl.git/+log/9a74210911fd..6a584e1d58d1

2026-02-19 davidben@google.com Make BORINGSSL_check_test take a pair of spans
2026-02-19 davidben@google.com Split RSA sign and verify KATs
2026-02-19 agl@chromium.org Run `go fix`
2026-02-19 davidben@google.com Update filippo.io/edwards25519 to 1.2.0
2026-02-19 davidben@google.com Fix the docs for and test BIO_free's return value
2026-02-19 xfding@google.com rust: Make true links in HPKE doc-string
2026-02-18 davidben@google.com Revert "Migrate Bio to RefCounted."

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/boringssl-dart-sdk
Please CC dart-engprod@google.com,dart-vm-gardener@rotations.google.com,dart-vm-team@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in BoringSSL: https://crbug.com/boringssl/new
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

Tbr: dart-vm-gardener@rotations.google.com
Change-Id: I422d42310b7462f1f87bee88b1dfa282007e00ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482380
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: DEPS Autoroller <dart-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-02-20 09:07:14 -08:00