Commit Graph

216 Commits

Author SHA1 Message Date
Konstantin Shcheglov 4aeb6c2544 Remove deprecated AnalysisContext.analysisOptions
Change-Id: Ie89087c4cbab17207371254d896f5b2be4ed437b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427602
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-05-09 10:49:01 -07:00
Sam Rawlins abd4e7754c Introduce two subclasses of 'LintRule' for handling multiple lint codes
Before this change, we had an enforcement that either 'get lintCode' or
'get lintCodes' is implemented, but it was a runtime enforcement. And it
was a little roundabout.

The new system is simpler and more typical:
* `AbstractLintRule` is the parent type, and it's sealed. It provides
  `get lintCodes` as an interface. Code outside of the lint rules
  requires this getter, in registering codes, etc.
* `LintRule` is the new subclass which is the "90% case." It declares
  a `get lintRule`, and offers simpler reporting methods for reporting
  a single code everywhere.
* `MultiLintRule` is the new subclass which represents that last
  "10% case." It only declares the reporting methods which all require
  a LintCode parameter, since there is no concept of a "default lint
  code among all my lint codes."

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

Change-Id: I63cbbfc1d936bb4428aa0b8f5fb0638c9b61b3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426284
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-08 16:10:57 -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
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
Danny Tuppeny 16d6594346 [analysis_server] Wire up analysis_options formatter/trailing_commas to formatter
+ validation + code completion

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

Change-Id: I383c888756e29e091c7abf8d4b8df66387714e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-24 11:59:05 -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
FMorschel befa614a90 [DAS] Optimizes library resolution for bulk_fix_processor
Bug: https://github.com/dart-lang/sdk/issues/60472
Change-Id: Ia26b47f94e0851ae5da6e52fde3f9a2c4a3a0d20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-04-21 09:47:14 -07:00
Konstantin Shcheglov 87ccd492a7 Elements. Remove V1 AnalysisSession.getParsedLibraryByElement and getResolvedLibraryByElement.
Change-Id: Ia124a11f3074a2f8d05c3ec517e59d8b6828af91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423071
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-21 08:19:51 -07:00
Konstantin Shcheglov 5b8b52422f Elements. Remove V1 from results.
Change-Id: Ic99558ffb7bf59eebd0afc1e392209a37261480f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-17 11:16:09 -07:00
Konstantin Shcheglov eefad8c43c Issue 58580. Support for getter_setter_error feature.
Bug: https://github.com/dart-lang/sdk/issues/58580
Change-Id: I1926ffb0157ef1b5c294487b183f93cbcb0ea177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-11 15:21:30 -07:00
Paul Berry 6c5c9d384f [sound flow analysis] Implement behaviors for is and as.
This change updates the flow analysis logic for `is` and `as`
expressions so that when the language feature `sound-flow-analysis` is
enabled, the static type of the operand is compared to the type to the
right of the `is` or `as` keyword. If one of the types is non-nullable
and the other type is `Null`, then the type test is known to fail. For
an `as` expression, this means that the code path following the
expression will be marked as unreachable. For an `is` expression, this
means that any code paths that assume it evaluates to `true` will be
marked as unreachable.

Note that these new behaviors break assumptions made by three
pre-existing flow analysis tests. I was able to adjust one of the
tests ("equalityOp_end does not set reachability for `this`") to
preserve its old behavior. The other two tests became redundant, so I
removed them.

There is no behavioral change if the feature `sound-flow-analysis` is
disabled.

Bug: https://github.com/dart-lang/sdk/issues/60438
Change-Id: Ib3a9e96bd39cf7df4c6c297568763c0f25bc9e39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-04-04 12:11:58 -07:00
FMorschel 82c3d74505 [DAS] Renaming positional parameters to rename hierarchy equivalent
Fixes: https://github.com/dart-lang/sdk/issues/53187
Change-Id: Ie0aaea2e24667ad04a95ce6522fd687710501230
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-07 10:29:44 -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 b3ca203e8f Elements. Start deprecating V1 elements.
This updates `analyzer_use_new_elements` lint to stop reporting inside
deprecated declarations. So, we can deprecated and prepare for removal.

Apply deprecation dart/analysis/results.dart

Deprecate `ElementDeclarationResult`, add `FragmentDeclarationResult` instead.

Change `getFragmentDeclaration` (not yet published) return type to `FragmentDeclarationResult` to better correspond to the method name.

Rename `getElementDeclaration` from `AnalysisSessionHelper` to
`getFragmentDeclaration`, to better reflect on what it operates.

Change-Id: I2839c9a7e21ed2e5b34035fc8c3ec88fd23df1b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-28 08:19:21 -08:00
Johnni Winther c714269f51 [analyzer] Migrate ElementDeclarationResult
Change-Id: Iaa18a32075e2dc92d47378d90cfb801bc5884473
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408702
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-18 08:22:51 -08:00
Paul Berry d3de420bf8 Add a custom lint to sanity check the analyzer public API.
The new lint, called `analyzer_public_api`, verifies that the analyzer
public API satisfies the following properties:

- No method, function, getter, setter, or supertype in the public API
  refers to a non-public type.

- No `export` declaration in the public API shows a non-public name.

- No declaration in the public API has a name ending in `Impl`.

- No file in the public API has a `part` declaration that points to a
  file that's not in the public API. (If it did, then the other checks
  could be circumvented.)

A new annotation is added, `@AnalyzerPublicApi()`, allowing
declarations in `package:analyzer/src` or
`package:_fe_analyzer_shared/src` to be marked as part of the analyzer
public API. This is necessary because some parts of the analyzer
public API need to be declared elsewhere and then exported by the
analyzer.

A few lint violations have been ignored using `ignore:` comments. I
will try to clean these up in follow-up CLs.

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

Bug: https://github.com/dart-lang/sdk/issues/60058
Change-Id: I0047a73dec8a29e2ffe03dd3a90f7e41ca2e27b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409763
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-14 05:24:22 -08:00
Sam Rawlins 50c1d9e1a3 analyzer: Fix remaining comment reference issues
Change-Id: I345c8d25e9f27dedffc596a2040cd89e059eb46e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-11 07:12:20 -08:00
Kallen Tu 89e545c5cc [dot-shorthands][co19] Rename enum-shorthands flag to dot-shorthands (and roll co19 to b14b080)
We've decided to rename enum shorthands to dot shorthands. It describes the entire feature better. It's not only for enum values. We'll update the experiment name before the implementation goes in, that way our users can use a flag that matches the actual feature name.

Additionally, roll co19 to b14b0802e696a60c79b00d0f052e26fb986f0faf so we can avoid an infra failure with co19 using what's now an unknown feature flag (enum-shorthands).

2025-02-06 sgrekhov22@gmail.com Fixes dart-lang/co19#3067. Rename the static access shorthand feature experiment flag (dart-lang/co19#3068)

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Bug: https://github.com/dart-lang/sdk/issues/57037
Change-Id: I031e3bce8166145b24dbb77acf259d78e6e00f0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407603
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-02-07 07:38:32 -08:00
FMorschel 07b7cfed07 New assist to add/edit hide at import for ambiguous import
Closes https://github.com/dart-lang/sdk/pull/56762

GitOrigin-RevId: af16e245090fa66e6212801cd862d809f5ede640
Change-Id: Ibbc49c36860ba6e58c45dfc40029e2375396c153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386020
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-05 15:49:35 -08:00
Konstantin Shcheglov 2946ea71d5 Macro. Remove more from analyzer/ and analysis_seever/.
Change-Id: Id5426cce73395d3d95657cf1e0b5f9d85fe3f574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-31 11:35:10 -08:00
Konstantin Shcheglov 94707b6b85 Add 'flags' to FeatureSet.latestLanguageVersion()
Change-Id: Iebeaf74ff44c2079b319308638fa731a013fdb90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406221
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2025-01-29 10:02:00 -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 3f159b2b93 Elements. Updates as needed for google3.
Change-Id: Ib76bf37a41d2fc0923ccddb1da37599589da3a5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396571
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-12-03 17:38:28 +00:00
Brian Wilkerson 73adec7b6f Migrate bulk_fix_processor.dart
Change-Id: I5385c0237d37ddf808609897dc846f100b11cd5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395703
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-16 15:26:19 +00:00
Kallen Tu 8b3c5aa8f5 Add experiment flag for enum shorthands.
This CL adds an experiment flag named `enum-shorthands`. We can start prototyping the work needed for the feature under the flag.

Bug: https://github.com/dart-lang/sdk/issues/57037
Change-Id: I5d5e679b20f993e0af59ce5b2d28e47269ecaedb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393521
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-11-07 20:42:41 +00:00
Sam Rawlins e66a8a4fa3 analyzer plugins: parse version and path keys in YAML
This enables plugin sources to be specified in one of three ways:

* as a YamlScalar, like `plugin_name: ^1.2.3`
* with a 'version' key, like `plugin_name:\n  version: ^1.2.3`, which
  allows diagnostic configurations to be alongside.
* with a 'path' key, like `plugin_name:\n  path: foo/bar`, which
  allows diagnostic configurations to be alongside.

We introduce a PluginSource with a `toYaml` method to convert the
values back into YAML for the generates pubspec. We update
PluginPackageGenerator to use PluginSource.toYaml.

Change-Id: Ic5f372f0339edd6aa638dd9b568a83f41a023b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 19:41:00 +00:00
FMorschel 6eda5e2019 [DAS] Fixes add const for final variables and lint
R=srawlins@google.com

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

Change-Id: I75dd2c0063ea5d3a6ebbf4afb734d2cb5d98c1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392860
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-11-05 15:48:00 +00:00
Sam Rawlins 0ed2082654 analyzer plugins: change rules options key to diagnostics
Also allow warning diagnostics to be disabled.

In many places, the RuleConfig is unchanged because currently the
`linter/rules` section parsing is shared with the `plugin/<plugin-name>/diagnostics` section parsing.

They will probably diverge at some point, but as long as they are the
same, we can use the same Registry class to identify enabled and
disabled rules/diagnostics.

Change-Id: I9c00770af14d3b753532bcf1bc6bff62624d99ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-04 23:50:29 +00:00
Sam Rawlins 784af8f704 DAS plugins: track lint rule configuration by name
* PluginConfiguration.ruleConfigs is now a Map instead of a List,
  mapping analysis rule names to each RuleConfig. This makes it more
  straightforward (and theoretically more performant) for the Registry
  to determine the set of enabled analysis rules. The primary parsing
  code, `parseLinterSection`, also returns a mapping now.
* This merges seamlessly into `AnalysisOptionsImpl`'s call to
  `parseLinterSection`.

This is most of the refactoring work found in
https://dart-review.googlesource.com/c/sdk/+/392981, but without the
change to allow warnings to be disabled.

Change-Id: I4d1e6791da83ad370c18a15e9e3bb85b1daed58d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-01 16:28:30 +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 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
Sam Rawlins 155a64c1b7 DAS plugins: Allow plugin rules to be disabled by default
This bumps the Registry class to be able to take "rules that are enabled  by default" and "rules that need to be explicitly enabled", "lint rules" and "warning rules". Next is to improve the classes.

Add parsing for the top-level `plugins` section, and
`PluginConfiguration` class to hold this data, and
`get pluginConfigurations` on AnalysisOptions.

Rename `parseLintRuleConfigs` to `parseLinterSection` to align better
with the other functions in engine.dart.

Rename `_ruleConfigs` function to `parseRulesSection`.

Change-Id: Ib93b7548bfb13cc94381971a5a2780a5dc81e9f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-28 01:42:02 +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 3518e02573 analyzer: Make strict modes part of AnalysisOptions API
I think when I was adding these modes, I put them on AnalysisOptionsImpl
to keep them secret and flexible. But they're pretty stable now.

Also split out the analysis options `include` tests to test merging
of individual lists and maps.

Change-Id: Ie54a1951dc82900c1fdfc06023cfa7cfb2f410a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391020
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-21 15:48:05 +00:00
Sam Rawlins 27ff526fe6 Improve doc comments for CodeStyleOptions
Change-Id: I0c507329f5c33ba82dc9aba980a740a340064b39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390266
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-16 18:10:40 +00:00
FMorschel 96ab3c1e44 [DAS] Consider two lint rules when converting forEach to a for-in loop.
R=keertip@google.com

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

Change-Id: I7188b3c8fee661623ea57158cc3cd0bf601b9fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-15 17:09:15 +00:00
Sam Rawlins 254b166180 analyzer: Simplify FormatterOptions impl
Change-Id: If68c615efcbec4ad07be3a51fc267a53829924c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-09 17:30:39 +00:00
Danny Tuppeny 5d84439f5d [analyzer] Add support for "formatter" in analysis_options + use page_width in LSP
This adds support for validation + completion for `formatter/page_width` in analysis_options, and uses this value in preference to the client-supplied value in the LSP server.

It does not yet add support for the legacy protocol, and there are a few questions in https://github.com/dart-lang/sdk/issues/56864#issuecomment-2399289974.

See https://github.com/dart-lang/sdk/issues/56864

Change-Id: I7844e3abd1191beb9cc24197bbc8aa7c9e9ad4fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388822
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-08 16:37:54 +00:00
Kallen Tu e872e360cf Add experiment flag for more flow analysis updates.
Working on a few bugs for flow analysis and I'll be putting them under this feature flag until we're ready to release.

Change-Id: I2bf01856d8d9cf0a8600a67c20df1a9b1c42e296
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388052
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-10-04 17:18:49 +00:00
FMorschel 83c26333a2 [DAS] Consider two lint rules when offering "add import" refactorings
Taking into consideration `prefer_relative_imports` and `always_use_package_imports` for adding import options to the assists list.

When neither is set, both will appear always showing package imports first. If both are set we will treat this as if only `always_use_package_imports` is and show only package imports.

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

R=scheglov@google.com

Change-Id: If2353479de91f50c6c44eb7a17487fb6d0d6f681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387500
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-30 19:17:36 +00:00
Konstantin Shcheglov e3e0275e2c Elements. Migrate DataDriven.
Change-Id: I355e846224549ca2795fee9f9d2b8ae7a4be32e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387351
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-30 00:48:03 +00:00
Chloe Stefantsova f6fe5615c4 [analyzer][cfe] Generate constraints based on type variable bounds
In response to https://github.com/dart-lang/language/issues/3009

Change-Id: I918d392e422f1997736bf2543c8107cb44d3d6f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364721
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2024-09-25 10:59:51 +00:00
Brian Wilkerson a6a2c57d68 Add API to AST nodes and session result objects to access the new element APIs
There will undoubtedly be other places where we need hooks, but I thought
that these would provide a good starting point for attempts to start
converting existing code to the new API.

Change-Id: If04aea4244efaca5a81553fbd88066b24c169290
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385303
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-13 23:29:47 +00:00
Sam Rawlins b1416116b7 analyzer: rename most API references to 'plugins' to 'legacy plugins'
Change-Id: I56217045ff9d4da8a5a556cd709e0f63a507884f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384964
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-12 21:25:56 +00:00
Kallen Tu 4e452651c8 [unquoted-imports] Add feature flag for unquoted imports.
Adds a feature flag named 'unquoted-imports' for the unquoted imports feature. We'll hide all the work behind this flag until it's ready for release.

Bug: https://github.com/dart-lang/sdk/issues/56701
Change-Id: I99c0647c74d0da40672d15509178d5234e61ffd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384585
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-09-12 16:51:20 +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
Fedor Shcheglov 4aaca0b4c0 Issue 56413. Consider prefer_int_literals in 'Wrap with Padding'.
Bug: https://github.com/dart-lang/sdk/issues/56413
Change-Id: I0e4aa2a53a2387caa4ad451e7033767c1b180436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-06 20:24:48 +00:00
Konstantin Shcheglov d90bb7321a Parts. Remove support for library augmentations.
Change-Id: I04f076ea6917bd4597b79c75db16207ccf387c9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383702
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-05 22:21:33 +00:00
Konstantin Shcheglov 726fc33e0a API. Deprecate 'ContextLocator' and 'ContextBuilder'.
Bug: https://github.com/dart-lang/sdk/issues/56102
Change-Id: Ia55b978571e412ea7b6b7c4b6cc482f731ecdc1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375760
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-07-15 20:31:19 +00:00