Commit Graph

1213 Commits

Author SHA1 Message Date
Danny Tuppeny 0b2961da1f [analysis_server] Update Go-to-Definition for factory keyword
Change-Id: I76b23e549d20a0716df6b43b091976e54774f922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483541
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-25 07:53:36 -08:00
Konstantin Shcheglov 19895724dd Breaking changes for analyzer version 11.0.0
Change-Id: I75c4dca69a99c0129cc8ae6934d5925382228a00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481542
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-24 14:36:29 -08:00
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
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
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
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 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
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
Danny Tuppeny 48849fa255 [analysis_server] Expand tests for Go-to-Definition for new() constructors
Change-Id: I9ce8c22730369d921eb3b0ecaed75ab6b7eb1a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-19 07:51:24 -08:00
Konstantin Shcheglov 41b05c8984 CQ. Rewrite identifiers resolving to types into TypeLiteral nodes
Modify the AST rewriting phase to transform `SimpleIdentifier` and
`PrefixedIdentifier` nodes into `TypeLiteral` nodes when they resolve to
a type (such as classes, type aliases, `dynamic`, or `Never`) and appear
within a value expression slot.

This change ensures a more consistent AST representation where type
references used as values are distinct from other identifiers.

Key changes include:
- Generating `isInValueExpressionSlot` methods for AST nodes to identify
  valid contexts for type literals.
- Updating `AstRewriteVisitor` to perform the conversion.
- Adjusting constant evaluation, completion, and linter rules to support
  `TypeLiteral` nodes in expression contexts.
- Adding comprehensive resolution tests for type literals in assignments,
  conditionals, loops, and other structures.

Change-Id: I248481dc9c940dfc0cbea4950b918d2e0a3d9bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479780
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-18 12:05:17 -08:00
FMorschel 30383e0ee2 [DAS] Fixes rules links for non-lowercase rules
Fixes: https://github.com/dart-lang/sdk/issues/62703
Change-Id: I4371edac64738fceb1725bea13d539bbf78247af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481400
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2026-02-18 07:31:31 -08:00
Konstantin Shcheglov d3d0ec9f66 Start analyzer 10.2.0-dev, analyzer_plugin 0.14.4-dev, analyzer_testing 0.2.1-dev, analysis_server_plugin 0.3.10-dev
Change-Id: I99ed03bc272bf6c243438b41b69c78dbf5511427
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481240
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-17 10:53:10 -08:00
Konstantin Shcheglov fc41bfcf92 Prepare to publish analyzer 10.1.0, _fe_analyzer_shared 95.0.0, analysis_server_plugin 0.3.9, analyzer_plugin 0.14.3, analyzer_testing 0.2.0
Change-Id: Ibe306aceaf6967a978fbf7e8bad07c3475e8ca10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481060
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-17 09:20:42 -08:00
Konstantin Shcheglov 98c4f54c0f Start analyzer 10.1.0-dev, analyzer_plugin 0.14.3-dev, analyzer_testing 0.1.11-dev, analysis_server_plugin 0.3.9-dev
Change-Id: I2ec7613ce0abcfa6e55f8c7837860319d9503adf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477641
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-02 11:54:49 -08:00
Jake Macdonald 39eba46d91 add presubmit checks for sorting, support only checking changed files
BUG: https://github.com/dart-lang/sdk/issues/52064
Change-Id: Ie45f22cbfb9f97018ba2bf6256f1470abc95a220
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476980
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-02-02 08:18:20 -08:00
Sam Rawlins 94a701bb0a Bump analyzer to 10.0.2, analyzer_plugin to 0.14.2, analyzer_testing to 0.1.10, and analysis_server_plugin to 0.3.8
This release is so we can publish a version of analysis_server_plugin,
and then start depending on that published version in DAS.

In addition, we get a highly requested fix out to analyzer_testing
users.

Change-Id: I694f47aeee59367c1fc066bc8f7a865406b09917
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476620
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-01-30 09:24:57 -08:00
Sam Rawlins d898aca90c analyzer_testing: Remove ClipRect.rect
Work towards https://github.com/dart-lang/sdk/issues/61597

Change-Id: Ib44d8a813d9a59cf7ebf2eb901140b2e9482b156
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-27 10:52:20 -08:00
Bogdan 606975ee96 [analysis_server] Add document links for plugins in analysis_options.yaml
Closes https://github.com/dart-lang/sdk/pull/62493

GitOrigin-RevId: 6fc5b1be2f40e9374173d20ef5646c781a65ec65
Change-Id: I147c5b4843d1e3437b9212ce6e66ca7285229621
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475422
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-26 14:25:28 -08:00
Danny Tuppeny eb174b33a7 [analysis_server] Support primary constructors in navigation
Change-Id: I2182d58e792eae85c60ff145196c90affcb32085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-22 09:00:39 -08:00
Sam Rawlins ca475a991d Release meta 1.18.0
analyzer package now depends on new TargetKind values in meta, so we
must bump the dependency to prevent crashes.

Change-Id: Ia639b0cd67c0dc70ae03613b6b1bfd4ad552788c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473421
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-01-15 11:41:02 -08:00
Konstantin Shcheglov 98d0db74e8 CQ. Use tryCast() instead of ifTypeOrNull().
Change-Id: I2a13f6b3a56c045cc35944360bc5a76894acf03f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472480
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-13 09:41:53 -08:00
Konstantin Shcheglov ef20543995 Prepare to publish analyzer 10.0.0, _fe_analyzer_shared 93.0.0, analysis_server_plugin 0.3.5, analyzer_plugin 0.14.0, analyzer_testing 0.1.8
Change-Id: I22aaf17a81027ac44d5f23b114ece789d66eed93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-01-07 11:25:23 -08:00
FMorschel ac0be94edd [analyzer] Adds lineNumberDifference and onSameLine methods to LineInfo
Bug: https://github.com/dart-lang/sdk/issues/61186
Change-Id: Ib0584203b000103f8137901c258a86ec571ff74c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471061
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-07 10:15:29 -08:00
FMorschel 20d8f8f166 [analyzer_plugin] Fixes writing recursive type parameter
Fixes: https://github.com/dart-lang/sdk/issues/62272
Change-Id: I2370adbf51b709e8860fcc12b6678cde504f1329
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469201
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-02 11:26:48 -08:00
Fedor Shcheglov bf5cfaedd9 Renamed variables, formal parameters, and declared identifiers that were incorrectly named elements, when they had a fragment type.
Change-Id: Id201a1f319ee2ae1e328c1d551a98df97bdc2b5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-29 18:04:29 -08:00
Paul Berry 5d199d6afe [messages] Move SourceRange class to _fe_analyzer_shared.
This will allow `SourceRange` to be referred to by classes in
`pkg/_fe_analyzer_shared` such as `LocatableDiagnostic` and
`SyntacticEntity`.

Change-Id: I6a6a69641f9daa351fbea3a0cc61f760f7a966d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467683
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-11 14:51:41 -08:00
FMorschel 2cbcc7f37c [DAS] Fixes Create (extension) method for unresolved closure return type
Fixes: https://github.com/dart-lang/sdk/issues/61898
Change-Id: I0b1e7ad208a54a04f0ff4147f27403845f9a379d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459521
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-10 10:40:00 -08:00
Paul Berry 5adc86d0ce [messages] Use lower case diagnostic names in analyzer_plugin.
Changes the logic in `pkg/analyzer_plugin` to use
`DiagnosticCode.lowerCaseName` instead of `DiagnosticCode.name`. This
ensures that diagnostic codes are matched in a case-insensitive
fashion.

This paves the way for deprecating (and eventually removing) the
`DiagnosticCode.name` getter.

Change-Id: I6a6a6964db7910a1226693ab60305b25aa02dce5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466130
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-09 06:40:32 -08:00
FMorschel 9f4c7e5d8b [DAS] Fixes Create setters, getters and fields for using type parameters
Bug: https://github.com/dart-lang/sdk/issues/61186
Change-Id: Ib70937ce8232ec087cf95d12d52a1bfdf59ad3ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442240
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-05 10:32:55 -08:00
Konstantin Shcheglov a135929050 DeCo. Stop using isSynthetic in analysis_server/, analyzer_plugin/, linter/.
Change-Id: I0764ad0bde41d97a98d9eb5b088b50b4eb69155f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465982
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-03 14:42:54 -08:00
Konstantin Shcheglov 342a0a7422 DeCo. Add PropertyAccessorElement.isOriginDeclaration, isOriginInterface, isOriginVariable. Same element text writer.
Change-Id: I4a80530e7fe8e971bb5ee3f1138d4e2756b3ff19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465742
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-02 20:59:00 -08:00
Konstantin Shcheglov fb0d56b81b DeCo. Use origin flags for constructors.
Introduce explicit origin flags on ConstructorElement and its fragment
(isOriginDeclaration, isOriginImplicitDefault, isOriginMixinApplication)
and deprecate isSynthetic in favor of these. Define isSynthetic as the
inverse of isOriginDeclaration to preserve the legacy meaning while
encouraging clients to use the more precise origin predicates.

Eventually `Element.isSynthetic` also will be deprecated and removed.
This CL is a step toward this goal, migrating what is possible with new
flags.

Update analyzer internals to rely on the new origin flags when checking
for non-factory generative constructors, building synthetic constructors
for mixin applications, and walking constructor chains in index/search
logic. Only constructors with an origin declaration are now treated as
declarations, and nonSynthetic is defined in terms of origin
declarations rather than synthetic-ness. Add corresponding origin
descriptors to the manifest enum and bump AnalysisDriver.DATA_VERSION.

Adjust analysis server refactorings and fixes to distinguish implicit
default constructors from other synthetic constructors. Code paths that
previously checked isSynthetic for default constructors now check
isOriginImplicitDefault, and mixin-application traversal uses
isOriginMixinApplication.

Overall, this change removes the overloaded semantics of isSynthetic,
makes constructor provenance explicit, and prepares the element model
for future DeCo and primary-constructor scenarios without relying on
brittle synthetic heuristics.

Change-Id: I8568bdfe478867af313a4d13afe1f2859394831b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465201
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-02 09:20:12 -08:00
Danny Tuppeny c8ab18f13e [analysis_server] Improve the display of unnamed extensions in LSP Outline, Document Symbols
We previously just showed "<unnamed extension>" for extensions without names, but in some files I noticed we have a lot of these, and the outline/symbols list looks awful (just "<unnamed extension>" repeated many times).

This changes it to instead show "extension on FooClass" instead (if there is a valid type name). I added a new field to the protocol to support this because the LSP classes convert from those classes (something we've discussed changing, but might be easier later).

Screenshots of before/after are in https://github.com/Dart-Code/Dart-Code/issues/5818

Fixes https://github.com/Dart-Code/Dart-Code/issues/5818

Change-Id: I3885a722443291bfa2419514841469c862b74450
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-25 13:49:55 -08:00
Konstantin Shcheglov abc6f1e378 DeCo. Switch linter/ and analyzer_plugin/ to ConstructorDeclaration.typeName
Not actual migration, uses null asserts.
Should be made safe as part of implementation in linter.

Bug: https://github.com/dart-lang/sdk/issues/61701
Bug: https://github.com/dart-lang/sdk/issues/62055
Change-Id: I08f709b9f9c74dbab1b41c4e12ed498135450531
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463465
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-11-20 14:26:46 -08:00
Konstantin Shcheglov ea84bc9df1 DeCo. Deprecate RepresentationDeclaration and RepresentationConstructorName.
Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: I3ed4ccabdd466654585e14f674bb404cde466c1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462861
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-11-19 10:08:13 -08:00
Sam Rawlins 2fb8ef8417 bump deps to analyzer 10
Change-Id: I181a914a4086d868a3dbed7d817f8bc04a72e2b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-11-17 12:39:49 -08:00
Konstantin Shcheglov 0349520b98 DeCo. Migrate everything to new AST.
No more flag, always parse into the new AST, always visit new AST nodes,
always return them as child entities, parent-child structure reflects
the new AST.

So, use `namePart` and `body` where possible. Deprecate previous
properties.

This is still de jure a breaking change, because `parent` of deprecated
properties changes. De facto this required very few changes in google3.

Once this CL lands, I will publish `analyzer 10.0.0`, migrate everything
to new properties, delete deprecated properties, and publish `analyzer
11.0.0`.

Maybe deprecate `NamedCompilationUnitMember.name` and migrate to
subclass specific `name` or `namePart` properties before publishing
`analyzer 10.0.0`. This part is not breaking per se.

* Deprecations in `ClassDeclaration`:
  * Properties `leftBracket`, `members`, `rightBracket` are deprecated, use `body` instead.
  * Properties `name`, `typeParameters` are deprecated, use `namePart` instead.
* Deprecations in `EnumDeclaration`:
  * Properties `leftBracket`, `constants`, `members`, `rightBracket` are deprecated, use `body` instead.
  * Properties `name`, `typeParameters` are deprecated, use `namePart` instead.
* Deprecations in `ExtensionDeclaration`:
  * Properties `leftBracket`, `members`, `rightBracket` are deprecated, use `body` instead.
* Deprecations in `ExtensionTypeDeclaration`:
  * Properties `leftBracket`, `constants`, `members`, `rightBracket` are deprecated, use `body` instead.
  * Properties `constKeyword`, `name`, `representation`, `typeParameters` are deprecated,
    use `primaryConstructor` instead.
* **Breaking Change:** While the deprecated members mentioned  above still exist in the AST,
  their parent nodes have changed. This means that code  relying on specific parent-child
  relationships for these nodes might break.

Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: Ic48104da8b029c9b454bbd2336574b7823025565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461841
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-11-17 08:57:36 -08:00
Konstantin Shcheglov ba1e7e8c45 Fine. Use 'withFineDependencies: true' in analysis_server_plugin/ and analyzer_plugin/.
Change-Id: If27c37c311afd5647fc1e4e741816ced5c9b576f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462221
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-11-14 15:22:43 -08:00
FMorschel c9f3e9a78e [DAS] Fixes Add missing parameter fix for super parameters
Fixes: https://github.com/dart-lang/sdk/issues/48359
Change-Id: Id7a286ad5757387a78a952c9367fc4cd071f7bba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-14 13:32:01 -08:00
FMorschel e4cec87683 [DAS] Fixes argument completion for dot shorthands invocations
Bug: https://github.com/dart-lang/sdk/issues/61969
Change-Id: Ie109e6bdf657ccbc02510da912087d2babf3806e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462081
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-11-14 07:42:38 -08:00
Sam Rawlins 151cc0ce8f analyzer_plugin: Remove remaining deprecated elements
Change-Id: Ia984b4462eba7d565ffe59ee07129118d8c399d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-11-13 07:36:52 -08:00
Paul Berry 9f6d1c1029 [messages] Start using toplevel diagnostic constants.
Changes the analyzer and related packages so that when they refer to
diagnostic constants, they do so via the import prefix `diag`, which
refers to the appropriate `diagnostic.dart` file containing the top
level diagnostic constant declarations, rather than the static
declarations inside `DiagnosticCode`-derived classes (which will soon
be removed).

This CL was created by the following steps:

- Run the script
  `pkg/analyzer_utilities/tool/messages/switch_to_toplevel_diagnostics.dart`.

- Execute `dart fix --apply --code=unused_import,unnecessary_import`
  on the following directories (this removes imports that are no
  longer necessary due to the change):
  - `pkg/analysis_server`
  - `pkg/analyzer`
  - `pkg/linter`
  - `pkg/analysis_server_plugin`
  - `pkg/analyzer_plugin`
  - `pkg/analyzer_testing`
  - `pkg/front_end`
  - `pkg/analyzer_cli`

- Execute `dart format` on the following files and directories:
  - `pkg/analysis_server`
  - `pkg/analyzer`
  - `pkg/linter`
  - `pkg/analysis_server_plugin`
  - `pkg/analyzer_plugin`
  - `pkg/analyzer_testing`
  - `pkg/front_end/test/scanner_test.dart`

  (Note that `pkg/front_end` and `pkg/analyzer_cli` are not
  re-formatted as whole directories because they contain `.dart` files
  that are test cases rather than source code, and reformatting those
  files might change test expectations.)

- Manually add `diag` to
  pkg/front_end/test/spell_checking_list_tests.txt.

- Manually fix the ignore comment in
  `pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart`. (The
  script `switch_to_toplevel_diagnostics.dart` automatically adds it
  after `import 'package:analyzer/src/diagnostic/diagnostic.dart' as
  diag;`, but then executing `dart format` bumps the ignore comment to
  the following line, where it has no effect.)

Change-Id: I6a6a69643022aab2b5a6224fb4124eead243260d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-12 16:53:42 -08:00
Sam Rawlins 8eb7c58b38 analyzer_plugin: Remove deprecated "methodBeingCopied" parameters
Change-Id: I7973e6badfbf9f9585707ea713c4ad27fe193584
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-11-12 14:14:19 -08:00
Sam Rawlins d4f2fec655 analyzer: Tidy and document LintCode.new and interpolated args
Deprecate the `hasPublishedDocs` parameter, as it is unused and
unnecessary. This triggers dev package versions.

Document how args are interpolated into problemMessage and correctionMessage.

A breaking change landed in analyzer_plugin, requiring a bump to
0.14.0.

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

Change-Id: I8e8f7e6af1c20ca9247cccd53e1fe2e5fc3cf083
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461581
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-11-12 13:13:11 -08:00
TejasSojitra12 b203ab1571 [analyzer_plugin] FooMixin classes are not mixins #61768
Change-Id: Icbccc25df1f2127212adb656955b74bdbafdd323
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460720
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-11-10 12:02:27 -08:00
Moritz 131760f204 Fix placing of field for bind_to_field fix
Now respect the `sort_constructors_first` lint when inserting fields.

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

Change-Id: I3d79ee0ea25d34af16a90a155406c08b5b5a8547
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2025-11-10 08:26:01 -08:00
Sam Rawlins e2204d36d7 DAS plugins: Update various docs
Work towards https://github.com/dart-lang/sdk/issues/61876

* Make a few notes about support beginning with Dart 3.10.
* Make a few notes indicating that plugins can only analyze Dart
  sources.
* Use the handy `> [!NOTE]` and `> [!WARNING]` syntax.
* Add a note about how plugins are resolved, and the dependency on
  analysis_server_plugin ^0.3.0.

Change-Id: I6ed5b3611a0ab4ff005917b0c5cff1b6fa9d5c95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459240
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-03 11:49:49 -08:00
Hassnaa Mohamed fc8b3d7927 docs: add notice linking to analysis_server_plugin
Closes https://github.com/dart-lang/sdk/pull/61820

GitOrigin-RevId: f45bed09b1360eeb3ff1119caf3edc188fdc27af
Change-Id: I77d6708b9a52fe40ed81a9e99e12b7df4ab01f2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-31 14:28:35 -07:00
Paul Berry ea768b29a4 [messages] rename diagnostic.dart.
Renames `pkg/analyzer/lib/src/diagnostic/diagnostic.dart` to
`pkg/analyzer/lib/src/diagnostic/diagnostic_message.dart`. The new
name aligns better with the library's purpose (which is solely to
export the class `DiagnosticMessageImpl` from
`package:_fe_analyzer_shared`).

This frees up the filename
`pkg/analyzer/lib/src/diagnostic/diagnostic.dart` to be used as the
repository for all generated analyzer messages.

Change-Id: I6a6a6964be0904a383334974f1e64a03c0df551b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458381
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-10-29 15:08:40 -07:00