Commit Graph

731 Commits

Author SHA1 Message Date
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
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 7b42aae99f analyzer: Deprecate AnalysisResultWithErrors.errors in favor of .diagnostics
Also rename UnitAnalysisResult.errors (package-private API) to .diagnostics

Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I0bdd7c9c19cff3bff9ee61fe4689564a7b5b727b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433581
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-09 15:51:01 -07:00
Sam Rawlins c219974ecf analyzer: Deprecate Diagnostic.errorCode in favor of diagnosticCode
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I2c7d64a81bc214e64fbc3ac95cf1fe2363a6ebd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433242
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-09 09:22:22 -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 b0b74b2810 Rename some loose ends w.r.t. "errorSeverity"
Change-Id: Id68fcd8bbbe45a95a294fd557ee4556c2af5c4c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430548
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-23 10:36:28 -07:00
Sam Rawlins 2dc94ee84a analyzer: Rename DiagnosticCode.errorSeverity to DiagnosticCode.severity
Change-Id: I244a96a940f82902a20e817fd13fe32026607ce3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-22 17:25:01 -07:00
Alexander Aprelev 1159405ad4 Revert "[DAS] Trigger incompatible lint for included rules"
This reverts commit 261f8199af 

Reason for revert: it breaks flutter customer testing on hh and on the roller.


Original change's description:
> [DAS] Trigger incompatible lint for included rules
>
> Fixes: https://github.com/dart-lang/sdk/issues/60125
> Change-Id: Icc0b8efda0e7e915d7315a1c2e70c1a7a5093057
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419982
> Auto-Submit: Felipe Morschel <git@fmorschel.dev>
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I0db90864092760efde1cb02cc792c1de14eabf2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429381
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-05-19 10:08:35 -07:00
FMorschel 261f8199af [DAS] Trigger incompatible lint for included rules
Fixes: https://github.com/dart-lang/sdk/issues/60125
Change-Id: Icc0b8efda0e7e915d7315a1c2e70c1a7a5093057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419982
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-16 17:31:21 -07:00
Sam Rawlins c4c9854b9b analyzer_testing: Move ResourceProviderMixin to analyzer_testing
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: I31932409e495369793dd16c017385c98b86cf44c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427480
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 16:56:29 -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 739ca671af Deprecate MemoryResourceProvider.convertPath in favor of extension
Work towards https://github.com/dart-lang/sdk/issues/55660

The comment for `MemoryResourceProvider.convertPath` includes:

> This is a utility method for testing; paths passed in to other
> methods in this class are never converted automatically.

and indeed, the actual impl of this method is found in an extension,
in analyzer's test_utilities/ directory. It seems to me better to
leave a testing utility as a testing utility, and not expose it in
the public API of MemoryResourceProvider.

Additionally, the extension method is used by `ResourceProviderMixin`,
which is moving to the public analyzer_testing package. It is illegal
to have a circular non-dev dependency between the analyzer package
and the analyzer_testing package.

The migration for the ~half dozen test files that use this method is
to call the extension method directly. Sometimes with an extension
override, and sometimes without.

Change-Id: I9c2e18600461134bfd91c082b3af0d5079600f0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426984
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-07 13:10:03 -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 e98a2af452 analyzer: Use DiagnosticSeverity in _fe_analyzer_shared and analyzer_cli
Work towards https://github.com/dart-lang/sdk/issues/60635

DiagnosticSeverity is the new name for ErrorSeverity.

Change-Id: I23a0e3d487934cea2f44a673215bc22faf34ee52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426000
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-05 11:11:20 -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
Kevin Moore 67a24ea983 [pkg] drop lints already covered by the included lint file
Change-Id: I84fdee27e3e28576187896502e5ffed487ee232f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425408
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2025-04-30 11:58:24 -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 f7ff419cd3 Remove analyzer_use_new_elements from analysis_options.yaml files.
Change-Id: Ic71fe16ae25001cc10673db2ef14d23d04f8a44b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-24 11:11:12 -07:00
Sam Rawlins ab909226e3 analyzer: simplify updateAnalysisOptions parameter signature
Currently, the `AnalysisContextCollectionImpl` constructor has a
callback parameter, `updateAnalysisOptions2`, which has 3 required
parameters. The caller can then pass in a closure which accepts those
parameters, and updates analysis options.

I find this to be a bit of an awkward API, and a little bit complex, so
it would be good if we can simplify it. It is all private impl, but it
is used in a few codebases, I believe. Dartdoc is one.

So, it looked to me like none of the callers _use_ the `ContextRoot`
parameter, so it would be good to simplify here, and remove it from
the callback signature.

This is _not_ the final API I'm looking for. Just an incremental step,
and since it is private API, it doesn't need to be in a major release
of analyzer.

Change-Id: Iad9da9f36e817add0bd8c49975ecd14311588661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392204
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-03-24 10:31:23 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
Sigurd Meldgaard a9ab52bcbb Language version bumps for publish_to: none pkgs
Also a separate pubspec for the tools/ folder

Extracted from https://dart-review.googlesource.com/c/sdk/+/397164

Change-Id: If49a6ede07e4864d0c0fcb210c04c18c804849df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412041
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-02-27 00:48:40 -08:00
Paul Berry a0b38184e2 Remove OWNERS file for the analyzer team.
The code that was previously owned by the analyzer team
(OWNERS_ANALYZER) is now owned by either the Dart Model team
(OWNERS_MODEL) or the developer experience team
(OWNERS_DEVELOPER_EXPERIENCE). Accordingly, we don't need
OWNERS_ANALYZER anymore.

Change-Id: I9a4d2e2462a15ba9ec8f3046cdca77ba9d3af13c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410564
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-18 12:24:57 -08:00
Paul Berry ca2d428f99 Add an OWNERS file for the new Dart Model team
Moving forward, the Dart Model team will own the following packages:
- _fe_analyzer_shared
- analyzer
- analyzer_cli
- analyzer_utilities
- front_end
- frontend_server
- kernel
- testing

In follow-up CLs I will create an OWNERS file for the developer
experience team, and then remove the OWNERS files for the old analyzer
and CFE teams.

Change-Id: Id7cf38ea41a6d3f9ca44f43fae1f310426a31e29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409841
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-02-14 15:51:17 -08:00
Konstantin Shcheglov b528b6e441 Macro. Remove most of the implementation.
Change-Id: Icd5966b91fb594a618dde38bb8b4c217ede75d9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406724
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-01-30 14:58:41 -08:00
pq a11d2feb92 [CQ] enforce unnecessary_ignore
Change-Id: Id2c57e56425aa31e86b78f081d71575e8fec7838
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406722
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-29 14:49:38 -08:00
pq 4f5aacfd90 [CQ] bump analyzer_cli to 3.7 and tall-style re-format
Change-Id: Ic0e1e33da71036800432aa3dae8df22dbef8a460
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404343
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-14 16:40:21 -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
Sam Rawlins c5a53edb69 analyzer: Simplify CLI; make AnalysisOptions nonPackageLanguageVersion a getter
The CLI was the only reason this field was mutable; dropping dead
support in the CLI means it can instead be a getter.

Change-Id: Iaaf3fd2a1cda9b568fb1a743827eb07fa8975319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-14 18:18:43 +00:00
Konstantin Shcheglov f02000e8d2 Elements. Use analyzer_use_new_elements.txt for opt-out, not opt-in.
So, we can see what is left to migrate.

Change-Id: I2440e23bf9f02401278f15adca91080e584a694f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393482
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 22:38:38 +00:00
Danny Tuppeny 27b52a3f82 Add languageVersion to CompilationUnit and make non-null
Change-Id: Ice6f866929f1f028d9b4e64685c2e815a08279f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-31 18:49:03 +00:00
Sam Rawlins 4cb5274108 analyzer: Move AnalysisErrorInfo into the linter test utilities
Change-Id: If6115cd0d3ffe4416f13567b79c835d0ab90bc79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392280
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-29 16:04:59 +00:00
Sam Rawlins bc58f69e53 analyzer: Move AnalysisOptionsImpl out of the generated directory
None of the code in AnalysisOptionsImpl or AnalysisOptionsBuilder is
changed.

Change-Id: I0d3253d80fdcd624c73720c35ece9d23a2582071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392180
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-28 21:03:33 +00:00
Brian Wilkerson a92ef52609 Migrate the last file in analyzer_cli
Change-Id: If0cacfab048174128be6eb0666893465929efaf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391200
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-21 18:15:53 +00:00
Brian Wilkerson 6adcc1ca54 Track migration in 5 more packages
Change-Id: I9a7a21c82d3083a13061d6da488b3951b49a1348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390823
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-18 17:03:29 +00:00
Sam Rawlins e29aa0cf3f analyzer: Convert applyOptions extension method into AnalysisOptionsBuilder builder.
Previously, the fields in an AnalysisOptionsImpl were primarily
arranged by an extension method, declared externally, called
`applyOptions`. It seemed very odd that this wasn't just a method on
AnalysisOptionsImpl; the "Impl" class is already private.

But it turns out that an AnalysisOptionsImpl is _mostly_ not mutated
in practice; the class wants to be immutable, with final fields.

In this change, I make AnalysisOptionsImpl mostly immutable, and
convert the `applyOptions` extension method, and all of its helper
code, into a builder class, AnalysisOptionsBuilder. While we don't
use a lot of builders in analyzer packages, this is a much more common
and idiomatic pattern for setting up complicated data, multiple values,
and then finalizing it all into an object that will not be changed
again during it's lifetime.

One big benefit of this refactoring is that most fields in AnalysisOptionsImpl are now final:

* sourceLanguageConstraint
* errorProcessors
* excludePatterns
* file
* strictCasts
* strictInference
* strictRawTypes
* chromeOsManifestChecks
* codeStyleOptions
* formatterOptions
* unignorableNames

Whereas before, they _all_ had to be mutable, as `applyOptions`, the
primary mechanism for setting up an AnalysisOptionsImpl, had to able
to write any field.

Other changes:

* Flip the instantiation of AnalysisOptionsImpl and CodeStyleOptions;
  now CodeStyleOptions is instatiated first, and AnalysisOptionsImpl
  sets itself as `codeStyleOptions.options`.
* Remove the private, deprecated, `applyToAnalysisOptions` function.

Change-Id: I6595d88aa5721e4f9a8b2b987482f9f43d27efd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390660
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-17 21:54:40 +00:00
Konstantin Shcheglov 3ef31903cc Parts. Un-deprecate LibraryElement.exportedLibraries/importedLibraries
They are used mostly as dependency tracking, because without combinators we don't know specific elements exported/imported. But for such dependency purpose CompilationUnitElement level "dependencies" are useless, so we should keep them at LibraryElement, but not add to CompilationUnitElement.

Change-Id: I14aaf14debaf167f29740e86d82ff2c02e241569
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389142
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-09 20:28:52 +00:00
Konstantin Shcheglov a4124616c9 Parts. Deprecate LibraryElement.importedLibraries
Change-Id: I3407e7fe0aa92218346d8376854a6e4a639e8013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-03 21:54:07 +00:00
Konstantin Shcheglov 5f7e2b1b60 Parts. Deprecate LibraryElement.exportedLibraries
Change-Id: Ieb542d5c7241f31ebae389badb9fd99c560cfd48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388144
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-03 19:49:51 +00:00
Konstantin Shcheglov 0de8f19be3 Parts. Remove isAugmentation, rename isMacroAugmentation to isMacroPart.
Change-Id: Ibf60f8d20f304a15ff9b2049788a3775fc09686d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383922
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-06 21:16:29 +00:00
Parker Lougheed 1f4f0d386a [linter] Generate lint codes from messages file
Change-Id: Id4f7ee5843a4063d1e527c1566847d88b355c614
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373725
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-08 19:24:30 +00:00
pq 932be2e170 remove singleOptionContexts flag
Fixes: https://github.com/dart-lang/sdk/issues/56352

Change-Id: Ie14bcb131f9ce85d4f25dbcc6c3be3d7238b5d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-31 20:12:00 +00:00
Sam Rawlins f4423e61ec Remove 4 old HintCodes, all replaced with WarningCodes
* UNNECESSARY_CAST
* UNUSED_ELEMENT
* UNUSED_ELEMENT_PARAMETER
* UNUSED_LOCAL_VARIABLE

Work towards https://github.com/dart-lang/sdk/issues/50796

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I15c74e5ebc626f7e513c04013aa2f81b36ca39a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377762
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-29 18:55:49 +00:00
Konstantin Shcheglov 1b9cc28879 CQ. Make FileSource API, move to lib/source.
Change-Id: I981d3f0904917ada322ca06448f03ff33ae1f095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-06-03 00:36:59 +00:00
Konstantin Shcheglov d696014fe5 CQ. Stop using File.createSource() in analysis_server/.
This mixes layers, which I believe one of the ways that cause large
library cycles.

Change-Id: Id7124b9f4e4bf81838f637255fe04fd28f5fda01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-05-31 19:43:58 +00:00
Konstantin Shcheglov b2329f92c0 CQ. Stop exporting src/file_system/file_system.dart
Change-Id: Idbd9f8ff36ebf339bf62e4a0c3d4d42009913d60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-05-31 14:55:02 +00:00
Jake Macdonald 25071fc448 revert dart:_macros, going with SDK vendored package
Change-Id: Iaaf80a44cdbd073b01132d04c0426e8acc28341f
Tested: Revert only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2024-03-21 02:40:58 +00:00