Commit Graph

14846 Commits

Author SHA1 Message Date
Konstantin Shcheglov 8779d4e9a7 Breaking changes for analyzer version 14.0.0
Change-Id: I3bd6b1bbf60bb1b45f46e62ebf448f27f103f98e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509561
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-11 11:59:47 -07:00
Kallen Tu 0f9e6da044 API - Deprecate the excludedPaths parameter in AnalysisContextCollection.
Path exclusions should ideally be defined inside a project's
`analysis_options.yaml` file, rather than being added programatically.

Plus, there's a bug with the constructor that causes this parameter to
be completely ignored anyways, so it's been obsolete and non-functional
for a while now. `getExcludedGlobs` in the `_ContextLocator` handles
parsing and adding excluded paths from the analysis server already, so
we should look into deprecating and removing this parameter.

Change-Id: I6c023041c7bb5fa4cb9dedc629afa4ea6ecb63d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511160
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 11:15:16 -07:00
Konstantin Shcheglov be4df1a869 API. Add Folder.getFile/Folder, deprecate getChildAssumingFile/Folder
This aligns names with ResourceProvider.getFile/Folder.

Change-Id: I30383ef1fa6f7cbe60b187338e25b8ca75806730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 07:46:21 -07:00
Konstantin Shcheglov 6d86b39595 Fine. Store formal parameter default values separately from FunctionType(s).
A type is just a type, it should not attempt to carry element semantics.

Bug: https://github.com/dart-lang/sdk/issues/63555
Change-Id: I9dacc4f5cc4060d862f7e1bb1ececdd9dc1a303c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510420
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 10:29:28 -07:00
Jens Johansen abd32d5449 [analyzer] Fix _OverlayFile.writeAsBytesSync
Change-Id: I3b4d7ad2b7a781c49abebef307a44dd9b3381b37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510361
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-06-10 01:08:18 -07:00
Konstantin Shcheglov fa78f9f947 Augment. Deprecate MethodDeclaration.isAbstract, add isComplete to ConstructorDeclaration, FunctionDeclaration, MethodDeclaration.
Change-Id: I3d5c884870ef183f54e59cd0a5c735373cbe71a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509900
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-09 11:28:23 -07:00
Konstantin Shcheglov ea50ec6486 API. Deprecate FormalParameterElement.formalParameters and typeParameters.
For clients outside the library the useful property in
`FormalParameterElement.type`, not *how* this type was specified
syntactically: `void f(int a<T>())` vs. `void f(int Function<T>() a)`.
This way, we have to think about these type parameters and formal
parameters only locally, like for example about local variables - they
exist, enclosed in a fragment, but don't leak outside into the element
model of a method.

I found this while working on the augmentations: that formal parameters
have to have the same types in the introductory declaration, and in
augmentations.

Change-Id: Ie4e92ebd0cd0204c4ba80200a9497e95859cc3e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-09 09:51:14 -07:00
Konstantin Shcheglov 55dcbad483 Augment. Hide augmentation recovery elements from signatures
Do not expose recovery type parameter and formal parameter elements
through the public element model. Recovery fragments are still needed
internally to link augmentation chains with mismatched shapes, but they
should not change the effective arity or callable signature of the
declaration being augmented.

Filter fragments marked as originating from another enclosing fragment
when computing executable formal parameters, executable type parameters,
and instance type parameters. This keeps function types, class arity,
and constructor or method signatures based on the real declaration
rather than on synthetic recovery elements introduced for invalid
augmentations.

Change-Id: I455a8a18bc07cdae30006754e069d687659aab1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510182
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-09 09:34:12 -07:00
Sam Rawlins 6fd091c444 analyzer: Avoid two-step constructors for TypedLiteralResolver
Change-Id: I13d9c5ef3b49d1112e1eb2c503b9d571fa458da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510183
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-08 17:29:20 -07:00
Konstantin Shcheglov 778a860a2a Add ElementAnnotation.isValidAtElement()
Bug: https://github.com/dart-lang/sdk/issues/63503
Change-Id: Iadc096c244607edcb773d70338f1b5b769c25128
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-06-05 18:02:28 -07:00
Konstantin Shcheglov 9a769de4b7 DeCo. Only regular formal parameters can be defining.
Bug: https://github.com/dart-lang/sdk/issues/63529
Change-Id: I5d9b0862d52e3d01dd15f1eb9845baad45fa0104
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509542
Reviewed-by: Paul Berry <paulberry@google.com>
2026-06-05 17:59:36 -07:00
Sam Rawlins 4c6fe56ae3 linter: Introduce no_raw_types replacing strict-raw-types
Work towards https://github.com/dart-lang/sdk/issues/63516

I have code here to deprecate the `analyzer/language/strict-raw-types`
setting. But I disabled it, as I realized we first need to ship an SDK
to Flutter that offers the lint rule, before we deprecate the setting,
which will cause CI to fail (like a Dart->Flutter roll).

When the deprecation is enabled, we can also ship the automated fix.

Change-Id: I17d1ea9aba96063059e37891c05d4a8bd3f02737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-04 14:12:28 -07:00
Konstantin Shcheglov 4da9a9133e Augment. Report augmentationPositionalFormalParameterName.
PS1: rename the test file.

Change-Id: I0e38a25c9c6d2b573766eb9a088fadbc8a4fc5b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509202
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-04 12:52:55 -07:00
Konstantin Shcheglov f9f9023516 Augment. Report positional / optional / named formal parameters shape mismatch.
Change-Id: Ia218cc02024a0a12f35a9c8fdba8b1e65f691244
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509161
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-04 08:50:36 -07:00
Jens Johansen 0fcf5363b3 [analyzer] Avoid more _SlowSetRange
This CL updates 3 places where ints are added to a (growable)
`List<int>` just to be (slow) copied to an `Uint32List` or `Uint8List`.

Before:

```
    39,419,429,182      instructions:u
    39,419,418,402      instructions:u
    39,419,444,064      instructions:u
```

With changes to `pkg/analyzer/lib/src/fine/manifest_ast.dart`:

```
    39,400,298,496      instructions:u
    39,400,111,564      instructions:u
    39,400,122,931      instructions:u
```

+ changes to `pkg/analyzer/lib/src/summary2/informative_data.dart`:

```
    39,377,663,819      instructions:u
    39,377,615,760      instructions:u
    39,377,658,088      instructions:u
```

+ changes to `pkg/analyzer/lib/src/summary2/reference.dart`:

```
    39,354,886,990      instructions:u
    39,354,710,428      instructions:u
    39,354,958,987      instructions:u
```

Combined, 10 run benchmarks:

Normal GC:

```
page-faults:u: -0.3153% +/- 0.1113% (-598.70 +/- 211.30) (189905.10 -> 189306.40)
instructions:u: -0.3646% +/- 0.0032% (-208298550.90 +/- 1831771.41) (57125057089.00 -> 56916758538.10)
maxRssKbytes: 0.3099% +/- 0.0124% (1916.40 +/- 76.62) (618475.60 -> 620392.00)
maxRssBytes: 0.3099% +/- 0.0124% (1962393.60 +/- 78455.89) (633319014.40 -> 635281408.00)

Comparing GC data:
MarkSweep(   promotion) goes from 15 to 17
MarkSweep(   old space) goes from 1 to 0
Notice combined GC time goes from 3528 ms to 3552 ms (notice only 1 run each).
```

Disabled GC:

```
page-faults:u: -0.1178% +/- 0.0170% (-1398.70 +/- 201.62) (1187291.70 -> 1185893.00)
instructions:u: -0.1647% +/- 0.0015% (-64920618.80 +/- 609688.86) (39419968252.50 -> 39355047633.70)
branch-misses:u: 4.6312% +/- 4.5821% (5247477.70 +/- 5191850.50) (113307038.50 -> 118554516.20)
maxRssKbytes: -0.1211% +/- 0.0069% (-5769.20 +/- 331.11) (4765063.60 -> 4759294.40)
maxRssBytes: -0.1211% +/- 0.0069% (-5907660.80 +/- 339060.21) (4879425126.40 -> 4873517465.60)
```

Change-Id: I78d2f61d82a993b8d1d76ab5f13230d8b6507ff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508564
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-04 03:28:19 -07:00
Jens Johansen 0c2d7decd7 [analyzer] Avoid _SlowSetRange in Scanner.tokenize
The analyzer makes a copy of `lineStarts` without the last element,
and copying it in to a `Uint16List` or an `Uint32List` depending on
what's needed (to avoid using more ram than necessary).

Because the (actual) scanner (`AbstractScanner`) does the same trick
with `Uint16List`/`Uint32List` the linestarts output from the scanner,
while a `List<int>`, is actually a `LineStarts` class, and copying that
into a `Uint16List` (or `Uint32List`) goes into
`_TypedIntListMixin._SlowSetRange` which as the name suggests is slower
than it has to be.

This CL puts the copying into the `LineStarts` class where it actually
has a `Uint16List`/`Uint32List` already, and doing the copy from that
instead avoids the slowdown.

Numbers from `perf stat`:

Before:

```
    39,552,191,101      instructions:u
    39,552,058,132      instructions:u
    39,552,065,649      instructions:u
```

After:

```
    39,419,426,977      instructions:u
    39,419,429,914      instructions:u
    39,419,441,613      instructions:u
```

Saving: about 132 million instructions.
Change-Id: Ibf6c7f6cc9324a54d2bd99c37058103af106164c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508580
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-04 00:07:49 -07:00
Konstantin Shcheglov 9c69609406 Augment. Rename ExecutableFragmentImpl.isCompleteDeclaration to isComplete.
Change-Id: I47d70e93da6e16e4019d61cf62533aba7818b7c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509140
Reviewed-by: Paul Berry <paulberry@google.com>
2026-06-03 18:05:12 -07:00
Konstantin Shcheglov d54a54d976 Augment. Rename FragmentImpl.isCompleteDeclaration to isComplete, text only.
Change-Id: I12bbec91d0498ba4a2cc428e3a2321875fcdba5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509101
Reviewed-by: Paul Berry <paulberry@google.com>
2026-06-03 18:03:42 -07:00
Sam Rawlins 5a94256582 meta: Introduce TargetKind.importDirective
Fixes https://github.com/dart-lang/sdk/issues/63467

Change-Id: I02f048405878d9ca578f8cbea318c59697f2811b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-03 13:34:57 -07:00
Konstantin Shcheglov d8fab3228b Augment. Support for function-typed formal parameters in augmentations.
Change-Id: I665810aaeeb96dceb0045c98d426493a0fc75892
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507960
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 12:24:36 -07:00
Konstantin Shcheglov 73d499369a Augment. Report defaultValueAlreadySpecifiedInAugmentationChain.
Change-Id: I0e12de28aea3f767bcd6e5f36a61c544c69e102b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507880
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 12:12:20 -07:00
Konstantin Shcheglov 33d4f1dff7 CQ. Migrate ToSourceVisitorTest from parseStringWithErrors() to parseTestCodeWithDiagnostics()
Change-Id: I902b4162f68acb2c220a2ee8c4ab8bcc47e3a3f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508423
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 12:03:14 -07:00
Konstantin Shcheglov 856afa7248 CQ. Fix superclassName value for constConstructorWithNonConstSuper.
Change-Id: Ib90558dfabf72b2a3743dc06b6bc4886eb65fbba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508442
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-02 11:57:55 -07:00
Konstantin Shcheglov fe53326c60 Augment. Report augmentsConstantVariable and constantVariableAugmentation.
Change-Id: I19f2d7c4771a88e8b03599d386ef9d62a26e80e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-02 10:29:14 -07:00
Konstantin Shcheglov fb2c014693 CQ. Improvements to indexing and search around DirectSubtypeWithMembers.
Separate the subtype search entry points by result shape and caller
intent. Use `directSubtypeReferences` for reference locations in subtype
clauses, and use `directSubtypesWithMembersOfType` /
`directSubtypesWithMembersOfSubtype` for indexed direct subtypes with
their declared instance members.

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

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

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

Change-Id: Ice71d9b116aca83372bf595f6e58a8ce4aa9e9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-02 10:28:16 -07:00
Konstantin Shcheglov 164cfda948 CQ. Migrate ast_test to parseTestCodeWithDiagnostics and findNode.
Replace the local marker-based _AstTest helper in ast_test.dart with
ParserDiagnosticsTest parsing and the shared findNode utilities. This
keeps the tests aligned with the inline diagnostics style used by other
parser tests, and avoids a second way to locate AST nodes from marked
source snippets.

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

Change-Id: Ib8c7c2e7c2c1b320c95810ce148b5a27e68dda43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-02 09:21:45 -07:00
Sam Rawlins f91c6ba493 DAS plugins: Do not report the "dependency_overrides" section as illegal
Change-Id: Ib7c3f88569172821c04bce96c1fcae4aa13e05c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508372
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-06-01 18:46:52 -07:00
Sam Rawlins 02ecbc8cf2 Report and offer fix for wildcard stack trace variable
Fixes https://github.com/dart-lang/sdk/issues/55738

Turns out there are many unused StackTrace variables here and there in
our tests, so those are ignored in a few files.

Change-Id: Iff9d0db265b96aca608261cb4518b372255d19cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501223
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-01 15:55:44 -07:00
Konstantin Shcheglov 0e976d5ab1 Augment. Report recursiveInterfaceInheritance on the clause, if self-reference.
Report direct recursive interface inheritance diagnostics on the
inheritance clause that introduces the cycle, rather than on the class
or mixin name. This gives a more precise target for self-references in
extends, implements, on, and with clauses.

Track recursive inheritance reporting per interface element across
fragments so that augmentation clauses can produce the specific
diagnostic when they introduce the cycle. Defer the generic cycle
diagnostic while earlier fragments still have later augmentations to
inspect, and use the element target as the fallback location for
indirect cycles.

Update diagnostic expectations to match the new locations and cover
augmentation and part-file cases for recursive extends, implements, on,
and with clauses.

Change-Id: I480a56e4b766d704c290d67d9ca4f6a73a2f655b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507300
Reviewed-by: Paul Berry <paulberry@google.com>
2026-05-29 12:57:07 -07:00
Konstantin Shcheglov 53f3ecc74d Augment. Report inconsistentInheritanceGetterAndMethod and inconsistentInheritance only on the introductory declaration.
Change-Id: I6f03031e2540b7d65995eba9608cdaf9651204e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507263
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-05-29 09:48:16 -07:00
Konstantin Shcheglov 67cada59b7 Augment. Don't report extra diagnostics when the executable element isAugmentationWithoutAugmentedDeclaration.
Change-Id: Ibe7c65e4ea53babfe8a308d6af310e053fe98ce2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-05-29 09:47:33 -07:00
Brian Wilkerson eb5a805486 Fix a false positive for unusedElement
Constructor parameters that were only referenced by a `super` parameter
in a primary constructor were being flagged as being unused because the
`super` parameter wasn't being visited. This CL causes all `super`
parameters to be visited.

Change-Id: Iad6eee87b3b74a387d86e783e3bb35300a801c12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507262
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
2026-05-29 07:31:29 -07:00
Konstantin Shcheglov a898adf8b7 Augment. Support for abstract top-level variables and static fields.
Change-Id: Idf0ce319492c405dd06364cb6feb81e000a7c741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506606
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-05-28 09:19:15 -07:00
Lasse R.H. Nielsen 69e9d32e87 Retire 'privately-named-parameters' experiment flag.
Change-Id: I6526bd63be5f71090a3ea7f3c705778e7debf584
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505340
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2026-05-28 05:13:49 -07:00
Konstantin Shcheglov ba760c36a4 Augment. Report augmentationInducedGetterAlreadyComplete and augmentationInducedSetterAlreadyComplete.
Change-Id: I87ba9c5b6c489417173a387bded700f52b52e7ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-05-27 11:17:44 -07:00
Konstantin Shcheglov 53c69a614e Augment. When moving enum 'values' constants from augmentation to the introductory declaration, skip 'values' fragment of the augmentation.
This `values` fragment is a purely synthetic construct.

Change-Id: I795e6b2a92d8d5809c8107b41522e0d41c7d03bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506220
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-26 10:39:42 -07:00
Konstantin Shcheglov 8c6366e66e Augment. Deprecate ExtensionTypeDeclaration.primaryConstructor, use namePart instead.
Extension type augmentations do not have representation declarations, so
an `ExtensionTypeDeclaration` can no longer always expose its name
through a primary constructor. Add `ExtensionTypeDeclaration.namePart`
as the canonical API for the declared name and type parameters, and keep
`primaryConstructor` as a deprecated compatibility API for introductory
declarations.

Report `extensionTypeAugmentationHasRepresentation` when an augmentation
writes representation syntax. This keeps the parser recovery explicit:
the augmentation still gets a plain `namePart`, while the invalid
representation is diagnosed instead of being modeled as the
declaration's primary constructor.

Synthesize recovery representation and primary constructor fragments
only for the element model when an extension type has no introductory
declaration.

Migrate analyzer, analysis server, analyzer plugin, and linter clients
to read extension type names and type parameters from `namePart`.

Change-Id: I59dd957ac38f087c861b993caf246986dcdac713
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505067
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-26 10:05:28 -07:00
Konstantin Shcheglov 4629bff7e9 Augment. Report extensionTypeAugmentationSpecifiesRepresentationField.
Add a syntactic diagnostic for extension type augmentations that declare
representation fields. Extension type augmentations may augment the
declaration, but they must not redeclare the representation.

Thread an explicit parser option through primary constructor parsing so
extension type augmentations can omit a representation without producing
the usual missing-primary-constructor diagnostics, while still reporting
an error when a representation is present.

Register the new diagnostic in the shared and analyzer generated
diagnostic tables and add it to fix status tracking.

Change-Id: I84815bb0669a76126564e590760e93096a3af046
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-22 17:36:54 -07:00
Lasse R.H. Nielsen 01ee1880aa Fix use of ExperimentalFeature.featureFlag! as feature name.
The `featureFlag` becomes `null` when the feature is expired,
the `featureString` is still available.

Code was added by https://dart-review.googlesource.com/c/sdk/+/470920 .

Change-Id: I5f19718d9431ff409907e82b2849d76415b739bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505440
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-05-22 08:40:52 -07:00
Konstantin Shcheglov 63893e2645 CQ. Remove AnalyzerErrorGroup and AnalyzerError.
Change-Id: I8ca41d616d19330e2a28a895c4bead93e05eb078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505660
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-05-22 08:12:13 -07:00
Konstantin Shcheglov 3582043f82 CQ. Split AstBuilderTest into exiting and new tests inside src/dart/parser/.
Move the remaining AstBuilderTest coverage out of the Fasta test
directory and into the corresponding parser test files under
test/src/dart/parser.

Place the migrated cases with the syntax they exercise, including class,
enum, mixin, extension, doc comment, record literal, record type
annotation, library directive, dot shorthand, and switch statement
coverage. Register the new parser test files in the parser test suite
and remove the deleted AstBuilderTest from the Fasta suite.

Add a find_node helper for locating a single RecordTypeAnnotation so the
migrated record type tests can use the same node lookup style as the
other parser tests.

Change-Id: I57370d161142ffa160c1a5e3972ffc25f3616d6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505060
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-21 11:50:27 -07:00
Konstantin Shcheglov 0220df06a8 Expand what BlazeWorkspacePackage.isInTestDirectory() allows.
Change-Id: I091c83e136c82c326d74660ebd2ffc186d3f8484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505480
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-21 11:22:03 -07:00
Konstantin Shcheglov eda0e21e25 Fine. Issue 63417. Fix indexing TypeParameterElement(s) inside GenericFunctionType inside constants.
Bug: https://github.com/dart-lang/sdk/issues/63417
Change-Id: Ia50094e8c39c5bce2e01639d8dc950e881305b4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505180
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-05-21 11:03:38 -07:00
Konstantin Shcheglov fb2962c045 Issue 63382. Use WorkspacePackage.isInTestDirectory() instead of CompilationUnitExtension.
Bug: https://github.com/dart-lang/sdk/issues/63382
Change-Id: I3c1d2495f9cb6804c73d1f36314556186f825a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505064
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-20 14:39:04 -07:00
Konstantin Shcheglov 39fcaa5d01 Augment. Allow 'static abstract' fields.
Change-Id: I42c4bbb9193c2debd3661898a8c410f76916958a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-20 08:49:01 -07:00
Konstantin Shcheglov a07da4d626 Augment. Order AST modifier tokens by the specification.
Update generated AST node metadata and token ordering so child entities,
begin tokens, and reconstructed source follow the grammar order for
modifier tokens.

Place `augment` before declaration modifiers on class type aliases and
the affected top-level and class-level declarations. Order field
modifiers as `augment external static abstract covariant`, and order
named formal parameter modifiers as `required covariant`.

Also emit the missing modifier tokens in `ToSourceVisitor` so source
reconstruction preserves augmentation syntax and the canonical modifier
order.

Change-Id: I57b4aa05f856779526bc3c8d5e3319d8c260bc49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504682
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-20 08:41:46 -07:00
Konstantin Shcheglov eba2982bc8 Augment. Report augmentationInducedGetterReturnTypeMismatch.
Report a dedicated diagnostic when an augmenting field or top-level
variable induces a getter whose return type differs from the getter
being augmented.

Previously, augmentation return type checking only covered executable
declarations with explicit return type annotations. Variable
augmentations that induced getters could therefore miss this mismatch,
or would not describe the induced getter case directly.

Add the new diagnostic code and use it for getter fragments induced by
variables. Keep the existing augmentation return type mismatch
diagnostic for methods and explicitly declared getters, and report the
induced getter diagnostic on the variable name so that mismatches in
multi-variable declarations are attributed to the specific variable.

Change-Id: Ifb421112d659815070110834702f68616e360a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-19 09:48:27 -07:00
Konstantin Shcheglov 76011f9fe0 Augment. Report augmentationWithoutGetterDeclaration or augmentationWithoutSetterDeclaration.
Add diagnostics for augmenting fields and top-level variables when the
augmentation induces an accessor that has no corresponding declaration
to augment.

Report these errors on each variable name rather than on the augment
keyword, so multi-variable declarations can report missing augmentation
targets independently. Include context pointing to the matching declared
or induced accessor when only one side of the getter/setter pair exists.

Register the getter- and setter-specific diagnostics in the generated
diagnostic tables and correction status metadata.

Change-Id: I78393a6e8bffe8748eb0fbc5182a0d01770771d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-18 18:42:53 -07:00
Konstantin Shcheglov 948e52a768 Augment. Build accessors induced by variable augmentations.
Property-inducing augmentations were linked to the existing field or
top-level variable element before creating the getter and setter
fragments that the augmentation itself induces. This left augmentation
fragments without their corresponding accessor fragments.

Create induced getter and setter fragments for every field and top-level
variable fragment, including augmentations. When an accessor element
already exists, append the new fragment to it; otherwise, create the
accessor element independently so that augmenting getter-only and
setter-only properties works correctly.

Track the relationship at the fragment level in both directions, from
each property-inducing fragment to its induced accessors and from each
accessor fragment back to its inducing variable. Serialize these links
in summaries, expose them through the analyzer element API, and bump the
summary data version for the format change.

Change-Id: Iede43515564326182d8195bd872abf83345bbd72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-05-18 08:20:07 -07:00
Konstantin Shcheglov 5ed538a532 Bug fix: implement missing diagnostic implementsSuperClassConstraint.
It is disabled when augmentations feature is enabled.

This is not a breaking change, because CFE did report this error.

The relevant reason is indirect, not a single sentence saying “on A
implements A is forbidden”.

Spec chain:

1. In dartLangSpec.tex:6019, a mixin declaration is modeled as:

`mixin N<T...> on T1, ..., Tn implements I1, ..., Ik { ... }`

2. In dartLangSpec.tex:6065, the mixin interface M_I is defined as if
by:

`abstract class N<T...> implements T1, ..., Tn, I1, ..., Ik { ... }`

and dartLangSpec.tex:6078 says it is a compile-time error for the mixin
if that synthetic class declaration would be a compile-time error.

3. In dartLangSpec.tex:5189, class superinterfaces say:

It is a compile-time error if two elements in the type list of the
IMPLEMENTS clause of a class C specifies the same type T.

So:

`mixin M on A implements A {}`

is checked like:

`abstract class M implements A, A {}`

which violates the duplicate implements type rule.

Change-Id: I29e5fa17c47d111346ef6a6e321ab5dbab985ad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-05-18 07:55:50 -07:00