Commit Graph

55977 Commits

Author SHA1 Message Date
Konstantin Shcheglov f2c40f98fd Prepare to publish analyzer 13.0.0, _fe_analyzer_shared 100.0.0, analysis_server_plugin 0.3.15, analyzer_plugin 0.14.9, analyzer_testing 0.2.6
Change-Id: I67692af1ed67a50b55ba1e7a5d907f85e6572040
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497342
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-04-22 11:38:06 -07:00
Konstantin Shcheglov 9d75d4db0d DeCo. Issue 63214. Add new tests for primary constructors and warnings.
Bug: https://github.com/dart-lang/sdk/issues/63214
Change-Id: I2054315eaddc87e0370f82ca8d2a1ebf140d4d18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497140
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-22 10:35:24 -07:00
Nate Biggs fdd833a689 Update import/export naming to take into account "internal" names and allow those names to be minified.
This reduces the size of both the mjs file (which contains the JS implementations) and the wasm file
(which includes these names as import/export names).

The savings here is relatively small for most apps.

A main impetus for this is the useful side-effect that it makes the names more stable. By assigning
names after TFA has run, the indices don't change when an unused JS method is added/removed. This
helps make the ir_tests more stable.

Change-Id: If47e3460d060a979bd41ef430c13c6828d98b549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494720
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-04-22 08:31:35 -07:00
Alexander Markov dff95e77a4 [modular_aot] Avoid generating code for instance members of mixins
After mixin transformation, original members of mixins should not be
called. Only their clones in the mixin application classes can be
called.

By removing their bodies we can reduce code size and avoid any
complexity related to super-invocations of abstract members.

Change-Id: I0ae1bbac6e4c82356841fdc870bfd8ca1bac8fb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497102
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-22 06:30:33 -07:00
Alexander Markov bd698307ac [modular_aot] Define type arguments field in the built-in classes
Issue: https://github.com/dart-lang/sdk/issues/61635

Change-Id: I4a6093afc01a2c68143e6e7d29d7661e17854a0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-22 06:22:01 -07:00
Alexander Markov 11d732e537 [modular_aot] Translate async/async*/sync*/await/yield/yield* to CFG IR
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ib5a7bc509e0382ceea53365b9ca3543a76a7cce1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496660
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-22 06:19:44 -07:00
Jens Johansen ff5858a2a1 [CFE] Set proper endOffset on constructor from primary constructor
If nothing else it's needed for
https://github.com/dart-lang/sdk/issues/62645.

Change-Id: Ibcc4cdd292cdec0c33a24c337861e1dd54da24f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-04-22 01:19:02 -07:00
Jens Johansen 41aa8d42bc Reapply "[kernel/cfe/etc] Split outline transformation into performOutlineTransformations and performOutlineComponentOperations"
This reverts commit 264098c85f.

Currently outline transformations aren't run via the incremental
compiler which causes problems in
https://dart-review.googlesource.com/c/sdk/+/491702 which fixes it by
calling the current transformation in the incremental compiler. This
calls it twice though (because it's run again in
`frontend_server/lib/compute_kernel.dart`, but removing it there doesn't
work because a filtering is done which doesn't apply through the
incremental compiler.

This CL splits up the outline transformation stage into a call that can
actually transform the libraries and one that can do the filtering,
which should fix the issue.

Original CL was reverted because it caused errors in google3. The
original CL is in patchset 1. The error has been reproduced and
recreated in a test added in patchset 2. The fix is in patchset 3.

The dwds failure @
https://github.com/dart-lang/webdev/actions/runs/24516059718/job/71660245069
has been verified as fixed as well.

The problem was this:

Previously outline transformations were not run by the incremental
compiler, but only outside. When it was moved to the incremental
compiler it had on old - outdated - `target` which for the ddc/dart2js
summary target would hold a list of source files that it was initially
created with, not the ones currently being compiled. This meant that the
transformation step that removed "unrelated" libraries actually removed
the newly compiled libraries instead. It could cause one of two issues:
1) Empty output: With no overlap between the combined output of the
   compile and the sources of the first compile (i.e. the ones in the
   outdated `target`) all libraries were filtered out. If a later
   compile was given this as a summary input the compile could fail with
   a file not found error because the given summary - which should
   contain the missing library didn't.
2) Non-empty output: With an overlap between the combined output of the
   compile and the sources of the first compile only the overlap would
   be included. In practise this would mean that the output would be a
   (potentially partial) copy of the first compile. If then a later
   compile was given both the summary from the first compile and the
   output with the copy it would throw when loading because it got the
   same library from two different summaries.

Change-Id: If712663acdbd7d25ccb3beab54a7efac0c0b0568
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496181
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-04-21 23:26:41 -07:00
Brian Wilkerson 463b751717 Add new unnecessary_type_name_in_constructor lint
This adds a new lint to recommend removing the type name from secondary
constructors.

It also adds a new fix that can automate the removal.

Change-Id: Ib6bc46b4455c360732553eadea3451d7dfb874a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497120
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-04-21 15:12:35 -07:00
Sam Rawlins 2f9d570cac linter: use_late_for_private_fields_and_variables: count field formals as nullable assignments
Fixes https://github.com/dart-lang/sdk/issues/63212

I added many test cases that are related and were missing, but the
primary test case for the bug is
`test_instanceField_private_withFieldFormalParameter`.

Change-Id: I3e8951f63801333373459bb1b191579b8e1f2188
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-21 14:42:01 -07:00
Keerti Parthasarathy a53d974caa [primary constructor]Add tests for property editor
Change-Id: I4b7592cf7a11943fa74352ab95bdce5099cf8692
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496663
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-04-21 14:20:06 -07:00
Sam Rawlins 6053e3a2b3 linter: Fix false positive with parameter_assignments and negate operator
Fixes https://github.com/dart-lang/sdk/issues/61169

The test case is weird. The issue is that `!p` was reported _only after_ `p = true;` is called. So it manifested as a double report. The test case leaves the `p = true;` statement.

The code is otherwise simplified.

Change-Id: I34b6e4ce0f90dc2ab6005e4fe400ca7d608184f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496440
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-21 14:12:28 -07:00
Sam Rawlins b1061cbd71 analyzer: Report invalid @internal annotation on primary constructors
Change-Id: I75d3f1f06a27ea0c3f4e4a6b24d9794b47c80cea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-21 13:04:25 -07:00
Konstantin Shcheglov 40dc31eed9 Elements. Remove MixinFragment.superclassConstraints
This is a breaking change, fortunately we are in the state when
analyzer 13.0.0 is not published yet.

Change-Id: Iaef69a3c6051f6d3cfe84cd66287d26a11baba2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-21 12:42:19 -07:00
Johnni Winther 99fb114199 [cfe][PrimaryConstructors] Treat enum generative constructors as implicitly const
This treats enum generative constructors as implicitly const when primary-constructors is enabled.

Change-Id: Ic12f31b52468d3f725861bce20e259029dfd1d74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-04-21 12:00:44 -07:00
Sam Rawlins 352bcf5489 linter: Do not report interpolated type variable as const literal
Fixes https://github.com/dart-lang/sdk/issues/57916

`computeConstantValue` gives you an
`AttemptedConstantEvaluationResult?`. That result has a
`DartObject? value`, so we need both the result and the `value` to be
non-null, to count the expression as a valid constant.

Change-Id: I7938be808d30b9734344e98dd966bb111d974fbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497060
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-04-21 10:34:59 -07:00
Ryan Macnak cd26f5e1cc [vm] Add missing serialization clusters for VM isolate objects.
TEST=ci
Change-Id: I738cf1a189accd2e449728bb599b6b92b5797924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496800
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-21 10:13:04 -07:00
Konstantin Shcheglov 18ab2664ca Augment. Report augmentationOfMixinApplicationClass.
Change-Id: I2649f4eb96fc232727fafa16129799ef3f207e20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-04-21 09:57:59 -07:00
Brian Wilkerson 78412eaeb8 Add new unnecessary_const_in_enum_constructor lint
This adds a new lint that was requested in order to support the primary
constructors feature.

This also enables the existing fix to remove the keyword and adds some
tests for the new use of the fix.

Change-Id: Iae3c86ca87a2af6abb82488e218d839a06699778
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496741
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-04-21 09:27:51 -07:00
Konstantin Shcheglov 291d8ae07d CQ. Create TypeParameterElementImpl instances in owning elements.
Create `TypeParameterElementImpl` instances when their owning elements
are constructed, instead of materializing them later in builders,
fragment linkers, and bundle reading. This makes ownership explicit in
the element model.

Update synthetic executable construction in inheritance handling to
build fresh type parameter and formal parameter elements. Top-merge and
covariance inheritance were previously able to reuse fragments from
other executables, which could attach fragments to the wrong element and
produce invalid synthetic members for generic signatures.

For type aliases, serialize the first fragment directly instead of a
fragment list. This matches how type alias elements are constructed and
avoids a separate read-time step that recreated type parameter elements.

Bump the data version for the format change.

Change-Id: If4f203f65fb11bcd0ffd1dcc0e47956b9fb2597b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496780
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-04-21 09:06:50 -07:00
Konstantin Shcheglov d2394cda16 CQ. Use buildLibrariesFromSpec() in type tests.
Expand the test library builder so more unit-style type system tests can
construct declarations through LibrarySpec instead of assembling
elements and fragments by hand.

Add support for imports and external libraries, enums, mixins, extension
types, type aliases, class mixins, type parameter bounds and variances,
and additional parsed type forms needed by these tests. Also add shared
helpers in type_system_base to build test libraries with the mock SDK
libraries and wire in the type provider and type system.

Migrate the affected tests to describe their libraries declaratively and
look up the resulting elements from the built library. This removes a
large amount of bespoke test-only element construction, drops helper
APIs that were only needed for hand-built declarations, and makes these
tests exercise element shapes that are closer to normal analyzer code.

Change-Id: Ic4180a64a5309b87b942f95ff45f682fbb8399df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496664
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-21 08:51:43 -07:00
Alexander Markov 7bf09be8f3 [modular_aot] Bugfixes and improvements in regalloc
TEST=pkg/native_compiler/testcases/register_allocator_test.dart

Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I22d88a6962290bd8aab0d4d3239d652e69242fbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495522
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-21 08:45:52 -07:00
Sam Rawlins 6abc631520 analyzer: Fix bug with operator of generic extension being marked as unused
The `addMember` API automatically handles type-substituted elements, so
adds the correct element for tracking.

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

Change-Id: Ib0c8f846bbb43afea274ea24591bd5b145a18422
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496740
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-21 06:19:30 -07:00
Martin Kustermann 4201b2677e [dart2wasm] Dart format pkg/wasm_builder
The change in [0] increased the language version of pkg/dart2wasm. That
in return changes how the package is formatted by the autoformatter.

This CL runs now the formatter to re-format the code. Unfortunately this
makes blame lists worse. But not doing it will make us have to disable
auto-formatting before saving files which is very annoying.

[0] https://dart-review.googlesource.com/c/sdk/+/487944

Change-Id: Ie3cbdc58bbd7f5aba187470554b7c958719fa795
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496940
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-04-21 05:52:14 -07:00
Martin Kustermann 0b7c68fad4 [dart2wasm] Roll binaryen to newer version
This brings in an optimization for [0] we filed

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

Change-Id: I2640d3c7d1f44a0bcc00129123a5ea6f8327047a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496860
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-21 05:27:37 -07:00
Chloe Stefantsova 7e18328cec [cfe] Share strategy object between instances of InferenceVisitor
Previously the context allocation strategy was created in the
constructor of `InferenceVisitorImpl`. Since the strategy manages the
creation of scopes and contexts, the area of effect of those were
limited by the area of application of the `InferenceVisitorImpl`
object. This is in conflict with the implementation of type inference
in constructors, where each of the constructor initializers and the
constructor body are infered by a distinct `InferenceVisotorImpl`
object. The changes in this CL allow a single strategy object to be
shared amont multiple instances of `InferenceVisitorImpl`, allowing
the scopes and contexts of constructors to be shared.

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

Change-Id: I27ad0ebf7dd9708293404af7cb004bbd639c193a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496620
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-21 04:19:53 -07:00
Erik Ernst e05ce41c0d Add anonymous => method related implementation in the CFE
This CL adds an implementation of anonymous `=>` methods in the CFE
which is sufficiently complete to handle the existing test cases in
language/anonymous_methods/expression.

Coverage is handled by adding magic comments to ignore the fact that new
code is not covered by existing testcases. This will be settled in a
separate CL.

To keep the failures visible, the failures in configurations
dart2js-hostasserts-linux-d8-try, dart2js-linux-chrome-try,
dart2js-minified-linux-d8-try, and ddc-linux-chrome-try have not been
approved. It seems likely to me that those are bugs in dart2js and in
DDC.

Change-Id: Ia70fedd4de6166d6a3bf8a108f49728b6e16c9f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494440
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-21 02:09:41 -07:00
Jens Johansen 5748206f2f [CFE] Don't format test files with short style; use same version as package
Fixes https://github.com/dart-lang/sdk/issues/63205.
Addresses comment in
https://dart-review.googlesource.com/c/sdk/+/490082.

Change-Id: I0460c3b5c1fdb5335e276beab7593cd589561aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496600
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-04-21 01:11:43 -07:00
Martin Kustermann 12174830ec [dart2wasm] Optimize the way we implement constructors
This reduces essentials main module around -0.4% and possibly
opens up for changes in the inlining (specifically to possibly
not force-inline all initializers anymore)

This shrinks the amount of information
* initializer result values
* the body parameters
* the allocator needs to forward less from initializer to body

We do that by analyzing constructor parameters to see
which parameters are needed for the constructor

Change-Id: I967fa4102ea6e9d498ff07aedabc368b038e1085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496341
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-04-21 00:13:42 -07:00
Sam Rawlins 5a97aee690 linter: Do not report cascade_invocations when assignee may be referenced in invocations
Fixes https://github.com/dart-lang/sdk/issues/57631

Change-Id: I04bd435ecf2db42cd0d704c28a266fa2b2e085bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496480
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-20 11:38:38 -07:00
Sam Rawlins 877ded1a38 analyzer: Tidy deferred_import_of_extension message
Fixes https://github.com/dart-lang/sdk/issues/56716

Change-Id: I9ce1ba3139a3eb388b3ceb18a898069531ccfa3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-04-20 11:12:05 -07:00
Sam Rawlins 299dabac5f DAS: Enforce constant_identifier_names lint rule.
All we have to do is ignore it in some generated files, and then it
is enforced in all other lib, tool, test files.

Change-Id: I5822db725f9c632820323dd20f5d4b6554808c26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464624
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-04-20 11:09:49 -07:00
Slava Egorov 53ac68e2dd [vm_service] Deprecate Stack.messages
Make VM always return empty array in the response.

Current implementation for this field comes with a bunch of complexity
because it locks message handler and then invokes Dart code which
makes it difficult to reason about various invariants. This code is 
furthermore demonstrated to cause deadlocks. Given that nobody uses 
it - it is simpler to remove this code altogether.

Fixes https://github.com/flutter/flutter/issues/185156

TEST=ci

Change-Id: I497210e0f1542860caa0d765d634f8ec6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496340
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-20 10:28:01 -07:00
Konstantin Shcheglov 9e690bdd06 Augment. Report augmentationOfDifferentDeclarationKind.
Keep track of the most recent same-named fragment even when it has a
different declaration kind. This lets augmentation validation
distinguish between a missing target and a target whose kind does not
match the augmentation.

Store this information on elements, serialize it through summaries, and
use it during error verification. When an augmentation finds a previous
declaration with the same name but a different kind, report
`augmentationOfDifferentDeclarationKind` and attach a context message
that points to the original declaration instead of falling back to
`augmentationWithoutDeclaration`.

This improves diagnostics for both top-level and member declarations,
including combinations such as constructors vs fields, methods vs
accessors, and functions vs variables.

Change-Id: Ic794c437fa160bb29d25f90559b544a7282ca697
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494301
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-20 09:33:03 -07:00
Sam Rawlins 47a4c9a0ae linter: Fix false positive in cascade_invocations wrt const instantiations
Fixes https://github.com/dart-lang/sdk/issues/61150

Change-Id: Ia3813d31e5e486c3cd8367179ba8adcc72102b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496403
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-04-20 08:52:11 -07:00
Konstantin Shcheglov 47bafbeaac Augment. Create TypeParameterElement(s) eagerly when building or reading element model.
Create `TypeParameterElementImpl` instances when fragments are built or
read, instead of synthesizing them lazily from
`TypeParameterFragmentImpl.element`.

This makes fragment-to-element wiring explicit and predictable across
the element model. To support this, accesses to `typeParameters` now
ensure that resolution has been read before returning element-backed
data.

The bundle format is adjusted so that type parameter metadata remains on
fragments, while variance, bounds, and default types are serialized with
the corresponding elements. This keeps the eager element creation model
consistent when reading summaries.

As part of this cleanup, generic function types and formal parameters
now create their nested type parameter elements up front, and
declarations that cannot have type parameters stop serializing empty
type parameter lists.

Change-Id: Ifcdc05bcccd2de6ae88d8102b10efe9a144e2545
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-20 08:38:59 -07:00
Konstantin Shcheglov 7874777488 CQ. Clarify bundle reader/writer fragment helpers.
Rename the bundle read/write helpers so their names reflect whether they
operate on elements, fragments, or whole library fragments. This makes
the serialization flow easier to follow and keeps the reader and writer
structured around the same concepts.

Also extract small helpers for imports, exports, parts, type parameters,
and formal parameters, so the bundle layout is spelled out more directly
instead of being spread across larger methods.

While doing this, move import prefix `enclosingFragment` wiring into the
`libraryImports` setter on `LibraryFragmentImpl`. This keeps prefix
fragments attached consistently whether they come from the library
builder or from summary deserialization.

Change-Id: I78f66f3e8a33d6c0dbf32bf9976ed666ceb6422c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496500
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-20 08:03:14 -07:00
Sam Rawlins 4776cc311c linter: fix unreachable_from_main for operators
Fixes https://github.com/dart-lang/sdk/issues/61891

Change-Id: I740a252fca989a7ab18b8f584beded37d9610609
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496460
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-04-20 07:46:21 -07:00
Chloe Stefantsova fac280bd7e [cfe] Add ScopeProvider as an interface of Field
Part of https://github.com/dart-lang/sdk/issues/61572

Change-Id: I8a9cb883181a584ceac9aef6a863e135474026eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495960
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2026-04-20 05:24:58 -07:00
FMorschel 4b89db909e [linter] Fixes join pattern variable case in prefer_final_locals
Fixes: https://github.com/dart-lang/sdk/issues/61673
Change-Id: I6e82395e64725dbd1821d874ced89154d8aca23c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-19 09:53:37 -07:00
Konstantin Shcheglov 6cd3938741 Breaking changes for analyzer 13.0.0
https://github.com/dart-lang/sdk/issues/62799
https://github.com/dart-lang/sdk/issues/62944
https://github.com/dart-lang/sdk/issues/63002
https://github.com/dart-lang/sdk/issues/62970

Looks mostly green in google3: https://fusion2.corp.google.com/presubmit/901021300/OCL:901021300:BASE:901308428:1776439417713:37cd1695

Change-Id: I44754a48f66a0b58851d7c20fcfa61f7fb1b555a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488624
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-17 23:06:25 -07:00
Brian Wilkerson b5da407918 Add tests of the property editor protocols using primary constructors
Change-Id: I6ec57b240da39ba925665dba5d1ec17fe4bef691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496380
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-04-17 17:24:20 -07:00
FMorschel bda52677b5 [DAS] Adds assist to "Add type name" on dot-shorthands
Fixes: https://github.com/dart-lang/sdk/issues/61984
Change-Id: I2e2599a4ef67fa0d25f28d3e7ff60f1519f00815
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472260
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-04-17 15:21:29 -07:00
Sam Rawlins 93f0b191b1 linter: Report more use_super_parameters cases where named can be converted
https://github.com/dart-lang/sdk/issues/58729

Change-Id: I257b89580fb31fcd21f9a33d3094dc3cb25063d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-17 12:45:29 -07:00
Konstantin Shcheglov 0f6a0ebad7 CQ. Replace shouldUseTypeForInitializerInference with isTypeInferredFromInitializer for property-inducing elements.
The old flag described a resolver behavior and defaulted to true, which
made persisted element data less explicit and caused many declarations
to carry the flag even when their type did not actually come from an
initializer. The new flag records the underlying fact we care about:
whether top-level inference produced the element's type from its
initializer.

Make top-level inference return both the inferred type and whether it
was derived from the initializer, and store that result on the element
when the type is computed. Use this recorded fact when choosing the
context type for initializer resolution, so only declarations whose type
was taken from the initializer fall back to `UnknownInferredType`.

Update the stored flags, manifest matching, result printers, and
serialized expectations to reflect the renamed and narrower semantics,
and bump the analysis driver data version for the format change.

Change-Id: I120f3cc289454c8ffc0963dcb028e2d5250f16da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496220
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-17 10:08:40 -07:00
Konstantin Shcheglov da16e9a256 Augment. Set isAbstract and isCompleteDeclaration for getters / setters originating from top-level variables.
Propagate flags to top-level variable accessors

Record `isAbstract` on top-level variable fragments and copy it to the
synthetic getter and setter fragments built from those variables. Also
mark those accessors as complete declarations when the originating
variable is external or not abstract. o later linking and element model
expectations stay consistent.

Change-Id: I36edfab18feaa2e2d9f8dca20dad837bd82f0836
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495943
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-17 09:26:32 -07:00
Keerti Parthasarathy a043789a6b [primary constructors] Add tests for data driven fixes
Change-Id: I31d8e782400ddac5b65c484dd5eb4fef9d86d88e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-04-17 09:02:20 -07:00
Ivan Inozemtsev 264098c85f Revert "[kernel/cfe/etc] Split outline transformation into performOutlineTransformations and performOutlineComponentOperations"
This reverts commit b3d9c8a297.

Reason for revert: b/503506653

Original change's description:
> [kernel/cfe/etc] Split outline transformation into performOutlineTransformations and performOutlineComponentOperations
>
> Currently outline transformations aren't run via the incremental
> compiler which causes problems in
> https://dart-review.googlesource.com/c/sdk/+/491702 which fixes it by
> calling the current transformation in the incremental compiler. This
> calls it twice though (because it's run again in
> `frontend_server/lib/compute_kernel.dart`, but removing it there doesn't
> work because a filtering is done which doesn't apply through the
> incremental compiler.
>
> This CL splits up the outline transformation stage into a call that can
> actually transform the libraries and one that can do the filtering,
> which should fix the issue.
>
> Change-Id: I5ae3477ebfe580dca372ea792924cdfb79979b35
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495700
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: I961a7d2e09f64f4b2e4dc9e45e1f3572f3f2cdeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-04-17 06:10:08 -07:00
Konstantin Shcheglov 91af82981b CQ. Write element and fragment flags using generated flagsForTesting.
Replace the hand-written header flag formatting for elements and
fragments with writeHeaderFlags(...flagsForTesting). This makes the
printed output come from the same generated flag definitions as the
element model instead of maintaining separate lists of writeIf calls.

Mark computed element flags such as hasDefaultValue, hasInitializer, and
hasNonFinalField in the generated metadata, and add the missing
generated overrides needed to expose them through flagsForTesting. This
also lets the shared path report flags such as isSimplyBounded and
hasEnclosingTypeParameterReference consistently.

Because hasNonFinalField now needs to round-trip through bundles for
enums, update the bundle reader and writer and bump the data version.

Change-Id: I7c126fe4bc69fd6b191f339ddc420b05cd8b5ee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495860
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-16 10:46:43 -07:00
Sam Rawlins 0918445e9f DAS plugins: Implement plugin shutdown support
Fixes https://github.com/dart-lang/sdk/issues/62974

Change-Id: Id3d1373b5814715b9b52d3f266557e85d620296e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495941
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-04-16 10:40:33 -07:00