669 Commits

Author SHA1 Message Date
Konstantin Shcheglov 1309dffc0a CQ. Move analyzer diagnostics back into analyzer.
Move the analyzer-only Diagnostic, DiagnosticMessage, Severity, and
locatable diagnostic helper types out of _fe_analyzer_shared and into
package:analyzer.

I paln to make changes outlined in
https://github.com/dart-lang/sdk/issues/63311 and chat discussion.
Keeping these classes in the analyzer simplifies the migration and
avoids introducing a shared abstraction before there is a concrete need
for one.

If we decide later need to have a shared abstraction, we can always
extract one at that point. With coding agents internal code motion is
cheap.

Update analyzer, analysis server plugin, analyzer plugin, linter, and
scanner call sites to import the moved APIs from analyzer libraries, and
refresh API baselines to reflect the new public owner.

Change-Id: Ie0ef0f01c6e4be7ebaac25619ac3e3fe991a44d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501000
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-05-07 13:54:59 -07:00
Paul Berry 22013528d6 [messages] Use lower case diagnostic names in analyzer.
Changes the logic in `pkg/analyzer` to use
`DiagnosticCode.lowerCaseName` instead of `DiagnosticCode.name`, and
`DiagnosticCode.lowerCaseUniqueName` instead of
`DiagnosticCode.uniqueName`. This ensures that diagnostic codes are
matched in a case-insensitive fashion.

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

Change-Id: I6a6a6964bae7f2d423e44211d2ad73202da65727
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-09 08:04:44 -08:00
Sam Rawlins 388a92b160 analyzer: Remove deprecated DiagnosticOrErrorListener and friends
Change-Id: I06d91cd3e10e27afd10056dfac978d918f594c6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-11-25 16:12:00 -08:00
Sam Rawlins 7059532b48 analyzer: Remove AnalysisErrorListener and friends
* Remove AnalysisErrorListener, `RecordingDiagnosticListener.errors`,
  and `RecordingDiagnosticListener.getErrorsForSource`.
* Deprecate `BooleanDiagnosticListener.onError` and
  `RecordingDiagnosticListener.onError` in favor of `.onDiagnostic`.
* Deprecate DiagnosticOrErrorListener. Where this class is used in
  private API, replace it with DiagnosticListener. Where this class is
  used in public API, keep it and ignore the deprecation lint.

Change-Id: Ie9c89008269db8f42e4ebd161df2764d27dfe0da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-20 12:58:24 -07:00
Sam Rawlins fae8a34f33 analyzer: Remove deprecated ErrorCode, ErrorSeverity, ErrorType
Change-Id: I914d0906ea417e186139c765b8d42a735dd263d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455461
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-19 20:41:36 -07:00
Konstantin Shcheglov 05bcfd2571 Breaking changes for analyzer version 9.0.0
Change-Id: I4d1b611edcf5340543b5cabf93b88a103408920b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444924
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-10-19 13:29:07 -07:00
Paul Berry 4da74f6145 [messages] Move fastaAnalyzerErrorCodes to a new generated file.
This unties it from being associated with `ParserErrorCode`, which is
a necessary step toward allowing shared messages of types other than
`ParserErrorCode`.

Change-Id: I6a6a69643358904884cf22e5d2aaa455175e5c78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454703
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-10-14 08:24:43 -07:00
Paul Berry 45b0e376f3 [analyzer] Introduce literate API for diagnostic reporting.
This change introduces a new literate API for reporting analyzer
diagnostics. The new API looks like this:

    diagnosticReporter.reportError(
      diagnosticCode
          .withArguments(...) // omitted if diagnostic takes no arguments
          .withContextMessages(contextMessages) // may be omitted
          .at(astNode),
    );

For comparison, the old API looks like this:

    diagnosticReporter.atNode(
      astNode,
      diagnosticCode,
      arguments: [...], // omitted if diagnostic takes no arguments
      contextMessages: contextMessages, // may be omitted
    );

For the moment, this new API is internal to the analyzer; it is not
exposed through the analyzer public API. This is to give us time to
try it out and make changes if necessary before we have to commit to
it.

The advantages of the new API are:

- Better static type checking: with the old API, if we accidentally
  forgot to supply arguments to a diagnostic code that required them,
  or vice versa, or supplied the wrong number of arguments, the
  mistake would not be caught until runtime. If we accidentally
  supplied arguments of the wrong type, the mistake would not even be
  caught at runtime. With the new API, any of these mistakes will lead
  to a compile-time error.

- Better code completion support: with the old API, if we can't
  remember whether a diagnostic code requires arguments, we have to
  look it up. With the new API, we can type the diagnostic code
  followed by `.`, and completions will be offered for either
  `.withArguments` (if arguments are required) or
  `.withContextMessages` and `.at` (if no arguments are
  required). Furthermore, while typing inside the parentheses after
  `.withArguments`, completion will offer the names of the required
  arguments.

To allow for a gradual transition to the new API, the old API is still
supported. To make this possible, a new sealed class `Reportable` is
introduced, to act as the parameter type for
`DiagnosticReporter.reportError`. It has two derived classes:

- The existing `Diagnostic` class (which was the old parameter type
  for `DiagnosticReporter.reportError`)

- A new `LocatedDiagnostic` class (which is the return type of the new
  literate `at` method).

The difference between these two classes is that the `Diagnostic`
class has already had its arguments formatted and disambiguated using
`convertTypeNames`, whereas the `LocatedDiagnostic` class hasn't.

The only change to the analyzer public API for now is the introduction
of `Reportable` and the change to the type signature of
`DiagnosticReporter.reportError`. (It would have been hard to avoid
making this public API change, since the method method
`DiagnosticReporter.reportError` is already exposed publically).

To make code review easier, this CL just introduces the necessary
infrastructure to allow a diagnostic code to start supporting the new
literate API, but doesn't make the necessary modifications to any
diagnostic codes to actually support it. In a follow-up CL, I will
flip the flag `literateApiEnabled`, which will change the generated
code and cause the new literate API to be supported.

In follow-up CLs after that, I will transition the analyzer over to
reporting errors using the new API.

Change-Id: I6a6a696478fdd74803c6215c64ec68626819dd95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-08-20 14:12:22 -07:00
Paul Berry 8e3aa277cb [analyzer] Move DiagnosticReporter into src/.
In a follow-up CL, I plan to add an extension on `DiagnosticReporter`
that's not exposed through the analyzer public API, so that we can try
out the analyzer's new literate API for diagnostic reporting without
exposing it to analyzer clients yet. The extension will need to be in
the same library as `DiagnosticReporter` (so that it can access a
private method), so in order to avoid exposing the extension through
the analyzer public API, that library will need to be in `src/`.

From the point of view of analyzer clients, this change is a no-op;
the `DiagnosticReporter` class is still available from
`package:analyzer/error/listener.dart` by way of an export directive.

Change-Id: I6a6a696426f43ee57789b8a7ec1c36bc0b8680ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446100
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-20 14:06:24 -07:00
Paul Berry 8b23e3449d [analyzer] Move some error reporting code into _fe_analyzer_shared.
The following classes are moved from `package:analyzer` to
`package:_fe_analyzer_shared`:

- `Diagnostic`
- `DiagnosticMessage`
- `DiagnosticMessageImpl`

The following declarations are also moved, since they are needed by
the above classes:

- `formatList`
- `Severity`
- `Source`
- `TimestampedData`

There is no change to the analyzer public API, and `export`
declarations have been added to the analyzer libraries that the
declarations have been moved from, so that code depending on these
declarations is unaffected.

These changes are part of a larger arc of work that introduces methods
`.withArguments` and `.at`, forming a literate API for reporting
analyzer errors that looks roughly like this:

    diagnosticReporter.reportError(
        ERROR_CODE.withArguments(...arguments...).at(...location...));

Moving this code into `_fe_analyzer_shared` is necessary because
scanner error codes are defined inside `_fe_analyzer_shared` (to allow
the scanner to be shared between the analyzer and CFE). Hence, to
avoid a circular depedency between `_fe_analyzer_shared` and
`analyzer`, the `.withArguments` and `.at` methods will need to live
in `_fe_analyzer_shared` too, as well as the classes representing the
diagnostic messages they create.

Note that there are some minor changes to
`pkg/analysis_server_plugin/api.txt` and
`pkg/analyzer_plugin/api.txt`; these have to do with the way the
`api.txt` generator chooses to report referenced elements, and don't
reflect actual API changes.

Change-Id: I6a6a6964a5c46f4a0205ce0d85620669ce55eb3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-12 11:09:33 -07:00
Paul Berry 8928283490 [analyzer] Stop using Diagnostic.data and deprecate it.
The only two uses of `Diagnostic.data` have been replaced with
expandos keyed off the `Diagnostic` object. To make this possible, the
`at...` methods of `DiagnosticReporter` have been changed to return
the `Diagnostic` object they create. This paves the way for a future
CL series, in which I plan to change the API for reporting errors to a
more literate API in which the caller will have access to the
`Diagnostic` object.

Change-Id: I40820387abcd53daf934974c93106803d706fe07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444461
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-11 15:18:17 -07:00
Fedor Shcheglov 8cfa901c6e Rename nameOffset2 to nameOffset
Change-Id: I3c8051840122b6046bc89ed48ec329c825607fe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440180
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-13 20:44:49 -07:00
Fedor Shcheglov 247ae2364f Deprecate Element.name3, use name instead.
Change-Id: I24a5e4a519b9f3bf755912f21a5c192edd1dd4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-08 14:13:49 -07:00
Sam Rawlins ee69f45a1f analyzer: rework AnalysisErrorListener deprecation
Work towards #60635

In this change, we rework the AnalysisErrorListener deprecation to
better support users who have their own class that implements
AnalysisErrorListener. This change introduces a sealed supertype,
DiagnosticOrErrorListener, with the old implementation,
AnalysisErrorListener, and the new implementation, DiagnosticListener,
as its sole direct subclasses. Users who have implemented
AnalysisErrorListener should be able to instead implement
DiagnosticListener, and their class is an acceptable instance of
DiagnosticOrErrorListener, wherever that is needed.

In a breaking change we can drop AnalysisErrorListener and deprecate
DiagnosticOrErrorListener, and in the next breaking change, we can drop
DiagnosticOrErrorListener.

For reference, see the first API difference when deprecating AnalysisErrorListener and introducing DiagnosticListener: https://github.com/dart-lang/sdk/commit/903d77cc8229972a424941dcb7b7b79741e833eb#diff-dec15868961d7eadcd009f49d129bebcdb747aaa8dbfde5f5a08884e0cf11e32

Change-Id: I3ccf11d54b41fbca98d020d89978d250c16b4c04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436480
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-25 06:54:20 -07:00
Fedor Shcheglov 1dc17b9a22 Deprecate Element.nonSynthetic2, use nonSynthetic instead.
Change-Id: Ie47d5f1e1fbaa7473747c5b43333a9c0cd689f74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435664
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-20 08:57:19 -07:00
Sam Rawlins 97c49e7514 Deprecate errorCodeValues for diagnosticCodeValues
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Ieea525a3f7260ea50e766feff0a0647fc0c33b4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434526
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-16 16:18:15 -07:00
Sam Rawlins 69cd0ee5f6 analyzer: Deprecate "errorCode" parameters in Diagnostic constructors
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Ifc173ec6e5924057fee3c420c8916f0abb257428
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434141
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-11 14:19:09 -07:00
Sam Rawlins f51d37e9b1 analyzer: Rename ErrorReporter to DiagnosticReporter
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I84b095199773040fc0444364964654c4373a9d77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433740
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-10 12:24:34 -07:00
Sam Rawlins 903d77cc82 analyzer: Rename ErrorListener classes to DiagnosticListener
Work towards https://github.com/dart-lang/sdk/issues/60635

I tried to keep this minimal but still sensible:

* Rename AnalysisErrorListener and all subtypes to use 'Diagnostic'.
* Rename all instantiations of such classes if they previously
  contained the word 'error'.
* Rename `RecordingDiagnosticListener.errors` to `.diagnostics`.
* Rename some _testing_ instance members that had the word 'error'
  to instead use 'diagnostic'.

Change-Id: I3948e27ba28ac2494092e04f4e1d201a20cc1135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433004
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-05 14:05:40 -07:00
Sam Rawlins 7a4c651eb3 analyzer: Rename 'errorCode' parameters in ErrorReporter
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I4a3d320585967a4d2e8cbed430d2a67aa3f905fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430040
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-21 16:12:59 -07:00
Sam Rawlins 8a17ad9f05 analyzer: Deprecate AnalysisError in favor of Diagnostic
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: If9bbc96beed95129b099588c5bd9728afda8e392
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426902
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-08 14:02:16 -07:00
Sam Rawlins 49562fd152 analyzer: Deprecate ErrorCode in favor of replacement: DiagnosticCode
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I0cfc0bff4e5d10b7cb373f77de55fffc13b8cf76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426641
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-06 14:43:10 -07:00
Sam Rawlins 9ab2139df5 analyzer: Deprecate ErrorSeverity in favor of DiagnosticSeverity
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Ic7f84584d4185e1ab7e8741052ec6694487c8c08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-05 13:58:32 -07:00
Sam Rawlins 57bfb6abd6 analyzer: Use new DiagnosticCode name in some directories
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I942e690ab2946c564c10df228d17bd44de4ed375
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425406
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-02 11:02:20 -07:00
Sam Rawlins 23b3450c8e analyzer: Make AnalysisError an alias for Diagnostic
Work towards https://github.com/dart-lang/sdk/issues/60635

Diagnostic has exactly one direct subclass, AnalysisError
(AnalysisError has a few more for tests). Diagnostic was previously
referenced only 7 times in all of analyzer.

This change is essentially a no-op.

Change-Id: I043970d96adcd7be4bb6a24d4a85b3f74309b7d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425682
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-01 10:08:05 -07:00
Sam Rawlins 24fbe71dd6 analyzer: Use DiagnosticCode instead of ErrorCode in tests
Change-Id: I6b70bda2e678777efdfde7c0cb9dca4ec85b27e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425686
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-01 09:18:03 -07:00
Sam Rawlins 35e8b9ba0b analyzer: Deprecate ErrorType in favor of new name, DiagnosticType
Change-Id: I552e816de6d526e3476cac9dd3ee2919fc7ec499
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425720
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2025-04-30 19:07:42 -07:00
Sam Rawlins 992cfb13bc analyzer: Deprecate AnalysisError.correction; simplify other final fields
Work towards https://github.com/dart-lang/sdk/issues/60635

* `AnalysisError._contextMessages` unnecessarily backed the public
  `contextMessages` getter; the field is final so it can be public
  itself.
* `AnalysisError._correctionMessage` unnecessarily backed the public
  `correctionMessage` getter; the field is final so it can be public
  itself.

Change-Id: If269d4ed590ef7df81d9b9e3be03766601526d7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425620
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-30 16:06:19 -07:00
Sam Rawlins cd07d191fc analyzer: Make AnalysisError._problemMessage non-late and public
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Id80912299c8bd9caafb9f6a9521168c74911f90d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425581
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-30 09:44:18 -07:00
Sam Rawlins d1696f890d CFE: Introduce type aliases for ErrorCode, ErrorSeverity, ErrorType
Work towards https://github.com/dart-lang/sdk/issues/60635

In this CL I only introduce the typedefs, update comments, and export
the typedefs. I don't change any references. Next we should update
internal references and maybe separately, any generated references.

Change-Id: I1c6d16580533b9283934261f56a6e5237e59109e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425343
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-29 16:19:30 -07:00
FMorschel 14c82024ea [analyzer] Adds context message for three or more ambiguous extensions
Fixes https://github.com/dart-lang/sdk/issues/59542

Change-Id: Ie7ae97397878db86a38cc369d3c21d18a2a03efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396540
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-04-29 11:39:38 -07:00
Konstantin Shcheglov b2fdd8a345 Elements. Rename XyzElement2 into XyzElement.
The CL was done with rename + adding typedef for each class.

Change-Id: Ia25cc581d2e42cf7d12a85a3579af952d5c232ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 13:27:18 -07:00
Konstantin Shcheglov 49599e06cc Elements. Deprecated element2.dart library.
Change-Id: I2be38df49e6f242d9fe59f34164549da4a0f41b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424683
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 11:23:18 -07:00
Konstantin Shcheglov becd91df17 Format analyzer/ with tall mode.
Change-Id: I410cd1cf63fbf00b868bbb3e060433cad3ac9e6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-21 12:15:58 -07:00
Konstantin Shcheglov 67b9a1be74 Elements. Remove V1 Element used in scopes.
Change-Id: Ic4f838e9033942137b1d4a855d9d378bb2a1931f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423073
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-21 08:38:34 -07:00
Konstantin Shcheglov 0046ae8a46 Elements. Migrate lib/error/listener.dart
Change-Id: I22ce676d84ff95cf8de485bf2fc91e31f0c27807
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-03 10:02:20 -08:00
Konstantin Shcheglov 91f5aad129 Elements. Deprecate V1 APIs in dart/element/type.dart
Add InterfaceType.getGetter2() and getSetter2().

Change-Id: I9f32fff71a9b643cc9fd46f0aaa87233689a9660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412940
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-28 14:18:59 -08:00
Konstantin Shcheglov d333e264e8 Elements. Migrate InstantiatedExtensionWithMember and related.
Change-Id: I1f0648ff0f16387d81e5eea9d82d2d4efe0c6a9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405660
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-23 17:00:31 -08:00
Konstantin Shcheglov 8bbe6fbdfe Elements. Report analyzer_use_new_elements without any txt file, add file ignores.
Change-Id: I13125f93a6633563ed6853a622bd9fec045bfc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403923
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-10 15:20:59 -08:00
Konstantin Shcheglov 91db72c394 Elements. Migrate GetterSetterTypesVerifier.
Change-Id: Ia568507df7c7c02df6706d4ff42c4b9f489f479a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395044
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-14 02:50:23 +00:00
Sam Rawlins 998cd101b8 analyzer: Correct comment references in some source files
This corrects about 40 of 220 comment_references issues in the analyzer
package.

In correcting the `experimentStatusToStringList` function, I see that
it is unused.

Change-Id: I0c2ec602262121337e7305797596fac9df987973
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-29 21:38:34 +00:00
Konstantin Shcheglov cf1f2e53a3 Breaking changes for analyzer version 7.0.0
Change-Id: Id6e329c7665d1dca1920d744dd7d0e9722da768c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311461
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-21 21:32:28 +00:00
Sam Rawlins 9baaa5f141 Reland "analyzer: Write out qualified extension names in error messages"
This is a reland of commit 10c1d883df

This includes a fix in listener.dart to not null-assert on an
element's name (`element.name!`). This fixes a problem in google
internal code.

Original change's description:
> analyzer: Write out qualified extension names in error messages
>
> Fixes https://github.com/dart-lang/sdk/issues/56269
>
> Change-Id: I025966fd4aa3d7c5b71175321f21f95e8c41f086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388580
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I6c20cf023af26b2d3b0fe9d8193f5e067719da8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389587
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-11 20:08:31 +00:00
Alexander Thomas d4aa30a3ba Revert "analyzer: Write out qualified extension names in error messages"
This reverts commit 10c1d883df.

Reason for revert: g/dart-sdk-rolls/MOLCzv4S-kQ

Original change's description:
> analyzer: Write out qualified extension names in error messages
>
> Fixes https://github.com/dart-lang/sdk/issues/56269
>
> Change-Id: I025966fd4aa3d7c5b71175321f21f95e8c41f086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388580
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I613695e90c96e5ffdb4dc56e729dc34be385f5fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388823
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2024-10-08 15:07:38 +00:00
Sam Rawlins 10c1d883df analyzer: Write out qualified extension names in error messages
Fixes https://github.com/dart-lang/sdk/issues/56269

Change-Id: I025966fd4aa3d7c5b71175321f21f95e8c41f086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-07 18:01:54 +00:00
Konstantin Shcheglov e41b531a59 CQ. Deprecate 'reportErrorForName', use 'atConstructorDeclaration' instead.
Change-Id: Ife3cdfd53551f12aa1b0dc6a223ae91e248ed33e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383444
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-03 20:22:37 +00:00
Konstantin Shcheglov 30b3f9d0a6 CQ. Deprecate 'reportErrorForSpan', use 'atSourceSpan' instead.
Change-Id: I4324154842ec462acbdda49e09d1a74f147c56f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383443
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-09-03 20:14:34 +00:00
Sam Rawlins 0e39ed67e6 analyzer: Expose LintCode as public API, for plugins
Work towards https://github.com/dart-lang/sdk/issues/50986

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Ie5783240e3fc2c9f8076b3efb13f79a3b8fa5000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-09 22:16:00 +00:00
Konstantin Shcheglov b4e30d1b45 CQ. Deprecate unused static members of AnalysisError.
Change-Id: I46e76defbc9a833a867cc3fa2154635f71a6d085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371422
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 23:39:21 +00:00
Konstantin Shcheglov 31a4bb7f60 DevX. Issue 22915. Show instantiated type alias in diagnostics.
Bug: https://github.com/dart-lang/sdk/issues/22915
Change-Id: I733bcb6021a167825840027df371fd22cfc71ce3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370701
Reviewed-by: Sam Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-10 21:19:08 +00:00