Commit Graph

525 Commits

Author SHA1 Message Date
Slava Egorov b3857af0e5 Bump core to 58b0a108b4d1310465e8482d6629357891df1cb1
Changes:
```
> git log --format="%C(auto) %h %s" 5c3e2c3..58b0a10
 https://dart.googlesource.com/core.git/+/58b0a108 Make it possible to add default subcommand (925)
 https://dart.googlesource.com/core.git/+/e43ff949 feat(collection): Replace quickSort with pdqsort for performance and robustness (922)
 https://dart.googlesource.com/core.git/+/f2efaaf3 Bump actions/checkout from 5.0.0 to 6.0.0 in the github-actions group (924)
 https://dart.googlesource.com/core.git/+/33b52327 Add `separated`, `separatedList` and `separate` to iterables and lists. (919)
 https://dart.googlesource.com/core.git/+/20ed9668 Add use_null_aware_elements to recommended (923)
 https://dart.googlesource.com/core.git/+/e6c3810c [crypto] remove the -wip to release new version (921)
 https://dart.googlesource.com/core.git/+/f7a786ac Bump actions/stale from 10.0.0 to 10.1.0 in the github-actions group (920)
 https://dart.googlesource.com/core.git/+/018e1dc7 fix(crypto): update conditional import for js interop library (915)
 https://dart.googlesource.com/core.git/+/9fefb52b Make Int64 default constructor non-const in native mode (916)
 https://dart.googlesource.com/core.git/+/f00841de Bump the github-actions group with 2 updates (914)
 https://dart.googlesource.com/core.git/+/7fee9c06 Fix `Int64.operator ==` (911)
 https://dart.googlesource.com/core.git/+/a4dc8738 Implement `Int64` as a wrapper for `int` when targeting native and Wasm (905)
 https://dart.googlesource.com/core.git/+/1aa58ef5 [fixnum] update the min. required dart sdk (907)
 https://dart.googlesource.com/core.git/+/60f2b5d3 Run fixnum tests with dart2wasm (906)

```
Diff: https://dart.googlesource.com/core.git/+/5c3e2c38df268be2347f3aad30ced0147dd012bb..58b0a108b4d1310465e8482d6629357891df1cb1/

Change-Id: Ibde49f27d1d26b8fc1aad3fd7df3efd924796b33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467361
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-12-12 00:42:31 -08:00
Paul Berry 479a081852 [messages] Use lower case diagnostic names in analyzer_cli.
Changes the logic in `pkg/analyzer_cli` 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: I6a6a6964f1254f248d2b772f69e33adf0b682bb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466186
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-09 06:32:27 -08:00
Paul Berry ce0c219753 [analyzer_cli] Remove unused CommandLineOptions.
Removes the field `AnalyzerImpl.options`, the `options` parameter of
the method `Driver._runAnalyzer`, and the `commandLineOptions`
parameters of the functions `computeSeverity` and
`determineProcessedSeverity`. None of these were used.

Change-Id: I6a6a6964617cecb81f0d1c6570be1d78fb599af4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463085
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-11-19 15:17:59 -08:00
Konstantin Shcheglov 6c5631ed88 Fine. Enable in analyzer_cli/.
Not for performance, because it is one shot, but all language/ and co19/
code will go through manifests builder, and give us better coverage.

Change-Id: Iae83ec685084847358d960deff81d18fb9904f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456404
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-10-21 14:38:58 -07:00
Jens Johansen 2c0648dd7d [analyzer cli] Don't ask for errors on the same file several times
```
$ out/ReleaseX64/dart pkg/front_end/tool/benchmarker.dart --silent --iterations=10 --gcs=5 --snapshot=pkg/analyzer_cli/bin/analyzer.aot.1 --snapshot=pkg/analyzer_cli/bin/analyzer.aot.2 --arguments="/tmp/extracted_compile_dart_compile/"
Will now run 10 iterations with 2 snapshots.
..............................

Comparing snapshot #1 (analyzer.aot.1) with snapshot #2 (analyzer.aot.2)
msec task-clock:u: -7.7915% +/- 1.2399% (-851.98 +/- 135.58) (10934.74 -> 10082.76)

page-faults:u: -1.7454% +/- 1.1131% (-2457.20 +/- 1566.98) (140777.80 -> 138320.60)
cycles:u: -5.6010% +/- 1.2559% (-2318118149.50 +/- 519783195.96) (41387425609.80 -> 39069307460.30)
instructions:u: -7.0130% +/- 0.5970% (-3636754009.20 +/- 309595118.25) (51857207312.90 -> 48220453303.70)
branch-misses:u: -6.2869% +/- 4.5941% (-9795625.90 +/- 7158088.69) (155810738.90 -> 146015113.00)
seconds time elapsed: -7.7884% +/- 1.2389% (-0.85 +/- 0.14) (10.94 -> 10.09)
seconds user: -6.0176% +/- 1.4855% (-0.59 +/- 0.14) (9.75 -> 9.16)
seconds sys: -22.3326% +/- 4.4197% (-0.27 +/- 0.05) (1.19 -> 0.92)
Comparing GC:
No change in combined time.
```
Change-Id: Ibb34829a42770c22567bc1399bcf7eaf26201e99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449121
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-09-11 05:45:20 -07:00
Sam Rawlins 958ae6ab1e analyzer: Simplify AnalysisContextCollectionImpl with new updateAnalysisOptions4 parameter
The new updateAnalysisOptions4 parameter is a callback function,
similar to updateAnalysisOptions3, but with one removed parameter
itself, the `DartSdk sdk` parameter.

The one place where this parameter was used in the callback passed by
the caller, was in DAS's ContextManager, and it was just used in order
to compute a FeatureSet from (a) the computed DartSdk and (b) the
command-line `--enable-experiment` options. We can instead provide a
`enabledExperiments` parameter on AnalysisContextCollectionImpl,
leading to a simpler API and still a simple implementation in
ContextBuilder.

The reason for the incremental migration is that dartdoc, and possibly
some internal clients, use updateAnalysisOptions3.

Change-Id: Ie990ab8f7b850aed1ce3ef39ab71c01835c080da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447400
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-27 11:05:29 -07:00
Sam Rawlins 0513a22206 analyzer_cli: Bump language version to 3.9
Change-Id: I4d696cb827c993e95c1f0c946b8cbce636a390fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-08-27 08:45:06 -07:00
FMorschel 83ecfc3ef0 [DAS] Adds some warnings for the analysis_options file
Adds `incompatible_lint` for included rules (and some variants of it) and `unsupported_value` error for linter rules values.

Original change: https://dart-review.googlesource.com/c/sdk/+/419982
Original change reverted at: https://dart-review.googlesource.com/c/sdk/+/429381

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

Change-Id: I0bc9a1a3c101c6455b8731cc0a40a39b6dfb5aac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-26 12:17:43 -07:00
Sam Rawlins 0ffd2849e4 analyzer: Move analysis options-validating code out of "task"
* OptionsValidator was defined in the `src/plugin/` directory (the only
  file in there), which I found confusing. Moved it to
  `src/analysis_options/`.
* OptionsFileValidator, and a few related classes, were defined in the
  `src/task/` (the last file in there!), so I moved it to the same
  place.

There is more to tidy in here, but this is a simple file-move.

Change-Id: I8f4c5cc0ae4e76eb6c17249457c50ab69c82590d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443147
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-31 15:05:31 -07:00
Fedor Shcheglov 238cd4c20a Deprecate constants2, lookUpInheritedMethod2, lookUpInheritedMethod2, classes2, classes2, extensionTypes2, extensions2, functions2, libraryExports2, libraryImports2, libraryImports2, mixins2, topLevelVariables2, typeAliases2, join2, isNonSubtypableClass2, and typeParameters2.
Change-Id: Ia4b5504d91548b561e2e2434e711c40b2dc5e495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-12 16:23:12 -07:00
Fedor Shcheglov 7218145cd2 Deprecate appendToWithoutDelimiters2, correspondingSetter2, unnamedConstructor2, getNamedConstructor2, entryPoint2, exportedLibraries2, getClass2, getEnum2, getMixin2, exportedLibrary2, accessibleExtensions2, importedLibraries2, importedLibrary2, isImplementableIn2, join2, variable3, getter2, setter2, correspondingGetter2, superConstructorParameter2, aliasedElement2, typeParameters2, constantInitializer2, and isNonSubtypableClass2
Change-Id: I091804b9f200f525baf3979773dd489e3be17697
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439640
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-07-09 20:34:14 -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 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 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 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
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
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
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 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
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
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
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
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
Keerti Parthasarathy 11e4f4574f Reland Workspace changes.
Fix lints that were showing up in flutter code.

Change-Id: Id5e2cbae347fd2c5d73418ce5af6ce579b62e1a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349629
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-02-05 17:33:09 +00:00
Jackson Gardner e9590179fe Revert "Refactor PubWorkspace into PackageConfigWorkspace"
This reverts commit 43fb59f4dc.

Reason for revert: Breaking Dart SDK -> Flutter Engine roller. See https://github.com/flutter/flutter/issues/142253

Original change's description:
> Refactor PubWorkspace into PackageConfigWorkspace
>
>  - use package_config.json as marker file for workspace.
>  - workspace can have multiple packages, they can be either PubPackages (marker pubspec.yaml) or BasicWorkspace.
>  - add package info (pubspec) to resolution salt.
>  - removed duplication of finding package_config.json from ContextLocator, as this is now done while creating workspace.
>  - some test/s setup/expectations were changed since we now use package config as marker for workspace instead of pubspec.
>
> Change-Id: I091a4a686c6b1d8c14858aefd9843a8d9c8efa25
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345346
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Keerti Parthasarathy <keertip@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I59adf5b26d25e360bcf962323db688156774c767
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348364
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2024-01-25 21:00:47 +00:00
Keerti Parthasarathy 43fb59f4dc Refactor PubWorkspace into PackageConfigWorkspace
- use package_config.json as marker file for workspace.
 - workspace can have multiple packages, they can be either PubPackages (marker pubspec.yaml) or BasicWorkspace.
 - add package info (pubspec) to resolution salt.
 - removed duplication of finding package_config.json from ContextLocator, as this is now done while creating workspace.
 - some test/s setup/expectations were changed since we now use package config as marker for workspace instead of pubspec.

Change-Id: I091a4a686c6b1d8c14858aefd9843a8d9c8efa25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345346
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-01-25 13:08:44 +00:00
Konstantin Shcheglov 3ab4358f33 Macro. Dispose AnalysisContextCollection(s) in analyzer_cli/
Change-Id: I0392f591c51c8eb1faef7b065ddfac18b1864e6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347201
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-01-19 00:05:17 +00:00
pq 7b7dfa6bb5 add analysisOptions to FileResults
See: https://github.com/dart-lang/sdk/issues/54667

Change-Id: I5d756e9f8ba2282c7c022a8dc6c11fe4da254a3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-01-18 22:05:18 +00:00
Konstantin Shcheglov 5df56a153c Add 'content' to FileResult.
Change-Id: I8600aed3beb712b4da9e4a157b2e87398057a9cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346902
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-01-17 20:35:10 +00:00
Paul Berry c46b63d2c7 Disable legacy code support in the analyzer.
Before this change, the analyzer supported analyzing legacy code if
the (somewhat confusingly named) global variable `noSoundNullSafety`
was set to `false`. This was used to support legacy code while google3
was still migrating to null safety.

Now that the internal migration process is complete, the analyzer no
longer needs to support legacy code. As a first step in removing that
support, this change removes the `noSoundNullSafety` flag and all the
unit tests that made use of it.

From this point forward it will not be possible to use the analyzer to
analyze code that has a Dart language version less than 2.12.

Change-Id: Idce4b271d1cfc43d25251b7a899259d62b421caf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345365
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-01-12 17:05:58 +00:00
pq 12598e6b0f deprecate analysis options sdkVersionConstraint getter
Noteworthy:

* deprecates the `sdkVersionConstraint` getter and updates uses
* migrates tests for sdk contstraints in the absence of a pubspec from context_builder_test to analysis_context_collection_test
* makes `pubPackages` getter broadly visible

Next step: remove the code that sets the `sdkVersionConstraint` in the analysis options object and remove the getter.


Change-Id: I443cdd15ec8d28ac6fa6786e06c1e4b027eee747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341084
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-12-12 00:20:50 +00:00
Konstantin Shcheglov ebf05be9b8 Macro. Add isMacroAugmentation to FileResult.
Change-Id: I5aa887212338bfc80a3f6cb15310f06ad1b2b48f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339107
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-30 21:30:23 +00:00
pq bec6e82853 migration to driver.getAnalysisOptionsForFile (continued)
Change-Id: Ia22286786febe7e915df0d7e7b18b9657fef2b07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-14 22:41:28 +00:00
Sam Rawlins 73ab31b98a analyzer: Move the Source class to be public API.
Deprecate accessing LineInfo, Source, or SourceRange via the
old library (pkg/analyzer/lib/src/generated/source.dart).
Migrate all SDK code to the new library.

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

Change-Id: Ic7c98a5820415c92a457f9fa2756351b05520cd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-14 17:10:37 +00:00
pq f962700302 + flutter_style_todos
Enabled `flutter_style_todos` in analyzer packages:

* `analyzer_cli`
* `analyzer_plugin`
* `analyzer_utilities`
* `meta`


Change-Id: I5fcd76bfa5a3bdeb14d6a81b8193129c6d83d0e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335405
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-13 00:14:09 +00:00
pq 9e6c856c27 migrate to getAnalysisOptionsForFile(file)
This migrates the bulk of the calls to `.analysisOptions`. I'll tackle the remainder in a few follow-ups.

Change-Id: I0f4c78d88938feecaba7202e0dc299dc17e2bb35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334647
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-08 21:48:38 +00:00