Commit Graph

2153 Commits

Author SHA1 Message Date
Samuel Rawlins b3f31a0440 Revert "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b551690c56.

Reason for revert: flutter customer tests failing: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738601049545714785/+/u/run_test.dart_for_customer_testing_shard_and_subshard_None/stdout

Original change's description:
> Reapply "analyzer: separate unused_element_parameter from unused_element"
>
> Fixes #49025. Fixes #48401
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> This reverts commit b888da751e.
>
> Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
> Tested: trybots
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: Ie0df2f4be45e5db2fa255dcf8c30ddf8408c155b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382420
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-27 17:44:28 +00:00
Sam Rawlins b551690c56 Reapply "analyzer: separate unused_element_parameter from unused_element"
Fixes #49025. Fixes #48401

This allows users to blanket ignore unused_element_parameter without
ignoring unused_element. They are reported in distinct situations so it
is valid to separate them.

This reverts commit b888da751e.

Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
Tested: trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-23 20:49:01 +00:00
Paul Berry 045d26bc74 Make unnecessary_breaks apply to default clauses
Fixes https://github.com/dart-lang/linter/issues/5061.

Change-Id: Ia5b9db3921d1d3aa95e19bc88cd3b4cde666d919
Bug: https://github.com/dart-lang/linter/issues/5061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380285
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-08-20 18:15:47 +00:00
pq 37bda88ce7 [wildcards] organize imports test
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: Iedffc92f6650fc6bd57672bad94c83acd54d26a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-19 22:17:41 +00:00
Keerti Parthasarathy 51bc97c22b Add a test to bulk fix processor to check for no exceptions when parsing yaml.
Change-Id: Ibfd800dfcd3f6640cd10eeffc398fb332956d1ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380079
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-19 15:04:30 +00:00
Paul Berry eb887c28bf Fix dead code removal when multiple cases share a body.
Fixes https://github.com/dart-lang/sdk/issues/56485.

Bug: https://github.com/dart-lang/sdk/issues/56485
Change-Id: Idea150d9b00bdf90ecff184da14ecbdbe5902a30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380901
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-08-16 14:19:28 +00:00
Sam Rawlins fbf62c12c2 DAS: Add assist to remove digit separators from number literal
Fixes https://github.com/dart-lang/sdk/issues/56467

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I711d0d483db0e61f907c884e33fb7511168dde2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380686
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-16 00:43:38 +00:00
Sam Rawlins 5a7b16ba4c DAS: introduce some assists that add digit separators to number literals
Work towards https://github.com/dart-lang/sdk/issues/56467

Thw two assists do the following:

* Add a digit separators every 3 digits in a decimal int, a decimal
  double, and a scientific notation double.
* Add a digit separators every 2 digits in a hexadecimal int.

No assists are introduced which remove digit separators.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I0920fb279285963c33a78d9288317213739ae83b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-14 20:22:47 +00:00
Erik Ernst eaabb3f8ab Add toString and hashCode as obvious, make int non-obvious
Change-Id: I5a83ba3e8d53972d00a16922cd681c0f330855f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380500
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-14 15:56:18 +00:00
Martin Kustermann b888da751e Revert "analyzer: separate unused_element_parameter from unused_element"
This reverts commit c1976b097d.

Reason for revert: It seems this change caused failures on Flutter
HHH bot. Example log can be found at [0]:
```
| lib/src/super_reader/super_reader.dart:615:14: Error: Final field 'showDebugLeaderBounds' is not initialized.
| Try to initialize the field in the declaration or in every constructor.
|   final bool showDebugLeaderBounds;
|              ^^^^^^^^^^^^^^^^^^^^^

```
Looking at the sources it seems that may be related to the
`// ignore: unused_element` analyzer directive:

```
   602	/// A [SuperReaderDocumentLayerBuilder] that builds a [SelectionLeadersDocumentLayer], which positions
   603	/// leader widgets at the base and extent of the user's selection, so that other widgets
   604	/// can position themselves relative to the user's selection.
   605	class _SelectionLeadersDocumentLayerBuilder implements SuperReaderDocumentLayerBuilder {
   606	  const _SelectionLeadersDocumentLayerBuilder({
   607	    required this.links,
   608	    // ignore: unused_element
   609	    this.showDebugLeaderBounds = false,
   610	  });
   611
   612	  /// Collections of [LayerLink]s, which are given to leader widgets that are
   613	  /// positioned at the selection bounds, and around the full selection.
   614	  final SelectionLayerLinks links;
   615
   616	  /// Whether to paint colorful bounds around the leader widgets, for debugging purposes.
   617	  final bool showDebugLeaderBounds;
```

So tentatively reverting this CL.

[0] https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8739650477551803313/+/u/Run_customer_testing_tests/stdout

Original change's description:
> analyzer: separate unused_element_parameter from unused_element
>
> Fixes https://github.com/dart-lang/sdk/issues/49025
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> Tested: Presubmit CI
> Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
> Change-Id: I4844a6a0e0a67cd5e37ed8735b1526e174deb950
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378500
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Ibbba75fe56601c7c4b5535c9142cf94c2dd80b91
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380460
Commit-Queue: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-14 08:05:37 +00:00
Sam Rawlins c1976b097d analyzer: separate unused_element_parameter from unused_element
Fixes https://github.com/dart-lang/sdk/issues/49025

This allows users to blanket ignore unused_element_parameter without
ignoring unused_element. They are reported in distinct situations so it
is valid to separate them.

Tested: Presubmit CI
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I4844a6a0e0a67cd5e37ed8735b1526e174deb950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-13 12:12:13 +00:00
Erik Ernst 5b7c600d8b Implement the lint 'specify_nonobvious_local_variable_types'
This lint is the complement of 'omit_obvious_local_variable_types'
in that it flags every declaration that does _not_ specify the type
of a local variable, when it has an initializing expression whose type
is not obvious (defined as in 'omit_obvious_local_variable_types').

Change-Id: If80a961e47fed0412d0ea0bac5ac010e26fea7bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-08-13 09:43:49 +00:00
Konstantin Shcheglov 4cea10fbf0 Parts. Report PART_OF_NAME when Feature.enhanced_parts is enabled.
Change-Id: I85925218b37a7cb65a7b50da6cc968155fd4789e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380043
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-12 20:11:06 +00:00
Konstantin Shcheglov 191996280a Parts. Switch from LibraryOrAugmentationScope to LibraryFragmentScope.
Change-Id: I6f8dd9a6c79afa6471a39cd56d0a24808555f569
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379662
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-08 18:22:52 +00:00
Sam Rawlins 093d867a0c analyzer: Remove DIVISION_OPTIMIZATION hint
This is replaced by the use_truncating_division lint rule.

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: Ied034267f4f8e5ea70ed0b4a21c39e88c88240ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378574
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-08-03 02:47:41 +00:00
Sam Rawlins ed622c5300 DAS: Move FixInFileProcessor to analysis_server_plugin
Also move the top-level `computeFixes` convenience function.

The `computeFixes` function is the main entrypoint that various code
uses to, well, compute all fixes with a FixProcessor and a
FixInFileProcessor. In order for plugin code to call `computeFixes`,
we need that function and FixInFileProcessor in the
analysis_server_plugin package.

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

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Id5f02864762eeefb92055a3534e91b60b76dfeb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-31 19:16:27 +00:00
Sam Rawlins 34ad8e075e Move FixProcessors and registeredFixGenerators to analysis_server_plugin
These two are needed in the shared package so that plugins can run
CorrectionProducers. They go in 'src' because plugin developers do not
need to see this code.

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

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Iee5b5dd063d5b0a9b00c58b91a3e50328c8b5fc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-30 21:17:13 +00:00
Sam Rawlins 3e58529caa DAS: Separate out registered fix generators into their own file
Work towards https://github.com/dart-lang/sdk/issues/53402

I move them all out of static fields on FixProcessor to be instance
fields on a singleton class in a new file, fix_generators.dart. For
each one that ended in the word 'Map', I removed that.

I also move `_bulkFixableErrorCodes` and `canBulkFix` to
BulkFixProcessor, as it is the only caller, and holds onto the data.

I also correct some outdated doc comments.

I also make `_isFixableError` static.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I01beccac4969f832941c75eb6d7b49b54a0b085c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377563
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-29 13:59:59 +00:00
Sam Rawlins 77bf16396e DAS: Simplify and modernize BulkFixProcessor
* Re-implement `PubspecFixRequestResult` as a Record.
  This was a class with two final fields, and the class is always
  immediately deconstructed, so it seems like a fine case for a
  Record. That being said, if this is "surprising", we can go back to
  a full class. I don't think there is a performance change; just API.
* 4 fields and 1 method on BulkFixProcessor can be private. Making one
  of these private enables promotion, removing the need for local
  shadowing variables.
* 2 fields on BulkFixProcessor can be visibleForTesting.
* 6 fields and 1 getter on IterativeBulkFixProcessor can be made
  private.
* Update doc comments to be more idiomatic.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I45ba8cbd428e281727cfc4dfba712be72d3325f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-25 19:20:47 +00:00
Sam Rawlins 535e8d5d85 analyzer: Rename Category to LintRuleCategory
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: If02b3f8a5f849f4ad837beb614b2ffbe27b36701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377269
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-25 12:36:50 +00:00
Sam Rawlins beee864196 DAS: Move away from LintNames, now that LintRules have LintCodes
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Id52cbf9fe95f9f2aaff80baaa10b2abbdba85f9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376560
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-07-22 06:43:58 +00:00
Sam Rawlins 4099544ec1 DAS: fix convert_to_int edge case with capital E
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I156faa542cc77f9de55e0997840cc864047415f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375746
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-07-20 00:31:58 +00:00
pq 7282f03fbe [enhanced-parts] don’t report use_string_in_part_of_directives
As this will produce a diagnostic, we don't want to double-report.

Fixes: https://github.com/dart-lang/linter/issues/5026

Change-Id: Ia745875a35d3c83c6fecf2a892b65a91c91fbb4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376760
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-07-19 19:18:22 +00:00
Sam Rawlins 11827c81b3 DAS: Add support to import a library for an extension type
Also tests for some other types.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I7fd41292f5c49bfb2d48ffae413cd51da781d081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376464
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-19 14:38:08 +00:00
Sam Rawlins 4e6d8115cd DAS: Move DartFixKindPriority, and rename values as lowerCamelCase.
FixProcessor has to be part of the analysis_server_plugin package, so
it cannot have any dependencies on the analysis_server package. This moves one.

The word 'default' is reserved, so I changed to 'standard'.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I1ee21c800203fac758f10a6fde0ea7d07eee5e7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-18 21:23:14 +00:00
Erik Ernst 9bce5ab112 Enable quick fix for omit_obvious_local_variable_types
This CL enables the same quick fix for said lint as the one which is
used with `omit_local_variable_types`: `ReplaceWithVar`.

Change-Id: I38644ac0a717dbe005224cdd8ffa029555dda943
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376320
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2024-07-18 16:58:20 +00:00
pq 5995cf6b00 [wildcards] Call Hierarchy target tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I80d37209fb69bfcacdec3bec943d75019e17966d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-17 21:53:53 +00:00
pq a9ec266732 [wildcards] Outline computer tests
See: https://github.com/dart-lang/sdk/issues/55681


Change-Id: I321bbcb9c1b45d10977aa860b0585c1d39632ea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-16 18:19:08 +00:00
pq 75617a12c3 [wildcards] quick fixes for DEAD_CODE_LATE_WILDCARD_VARIABLE_INITIALIZER
Fixes: https://github.com/dart-lang/sdk/issues/56221

Change-Id: Ie599d570bf6a6f13987a4175f955eb522ae20a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375784
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-16 15:24:07 +00:00
Sam Rawlins 1395cbbbd0 DAS: eight-digit hex: respect x case and expected triplet separators
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Icc444c1d6ac80e6b5c6c98c1e8d64506fbec5820
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375723
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-16 15:05:30 +00:00
Sam Rawlins d84619e6b8 analyzer: Support digit separators in use_full_hex rule
Work towards https://github.com/dart-lang/sdk/issues/56188

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I75897ffdcacd3613b9e5f5095932f514c4653fac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-15 22:37:33 +00:00
Sam Rawlins 63f47bbb5a Prepare prefer_int_literals rule and fix for digit separators
Work towards https://github.com/dart-lang/sdk/issues/56188

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I3a6ed7cb8b61a63c0b2742f408e42e4ae09d732a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375741
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-15 19:53:49 +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
Sam Rawlins 04dcf09b94 analyzer: Add quick fix to remove unexpected underscores from number literal
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I9bec5b6101a5642973d3a0abb568b044cddb892e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375061
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-09 21:12:50 +00:00
Keerti Parthasarathy b971e8cb08 Fix for 'avoid_init_to_null` fix for late variable declarations.
Fixes https://github.com/dart-lang/sdk/issues/55941

Change-Id: Id7bdd133ec302919a436b54a205c279434b2b523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-07-08 20:06:31 +00:00
Sam Rawlins f274b8a4c4 linter: require LintRules to either declare 'lintCode' or 'lintCodes'
Work towards https://github.com/dart-lang/sdk/issues/50986

This found a few lint rules that had not declared a `lintCode` or
`lintCodes`! So I corrent them as well, and a few grammar nits in their
descriptions.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I2bca3bbc382d1f25a3291326eb3b660c06d8917d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372183
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-05 04:53:18 +00:00
Keerti Parthasarathy ef9afb4383 [dart fix] Support for fixes when only part files have diagnostics.
Fixes https://github.com/dart-lang/sdk/issues/55520

Change-Id: Ibebe155e00758a6bf36e0327c130be70f2910238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374100
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-03 15:26:41 +00:00
Ann Marie Mossman 1c0c5f355f Issue 54063: fixed formatting issues
Issue 54063: Adding in file quick fix support for missing semicolons and associated test

R=srawlins@google.com

Bug: https://github.com/dart-lang/sdk/issues/54063
Change-Id: Ia1a20129e3c630d977ab3d40bf8e79b0ed852936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373326
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ann Mossman <mossman@google.com>
Auto-Submit: Ann Mossman <mossman@google.com>
2024-07-02 17:30:49 +00:00
Danny Tuppeny 916272331b [analysis_server] Remove the singleton uriConverter and pass explicitly to all toJson/fromJson methods
This avoids accidentally using the converter when talking to plugins, (at least for now) URIs are never expected, and file paths should always be used regardless of which mode the server is in.

This unfortunately touches a _lot_ of code, so I've pushed in many separate patch sets to Gerrit.

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

Change-Id: I312c3e2cbc35a05a078aaa0138aec7288b3c7dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373745
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-02 14:15:11 +00:00
pq 7d22d99b9b quick fixes for EXPECTED_BODY diagnostics
* `EXPECTED_CATCH_CLAUSE_BODY`
* `EXPECTED_CLASS_BODY`
* `EXPECTED_EXTENSION_BODY`
* `EXPECTED_EXTENSION_TYPE_BODY`
* `EXPECTED_FINALLY_CLAUSE_BODY`
* `EXPECTED_MIXIN_BODY`
* `EXPECTED_SWITCH_EXPRESSION_BODY`
* `EXPECTED_SWITCH_STATEMENT_BODY`
* `EXPECTED_TRY_STATEMENT_BODY`
* `MISSING_ENUM_BODY`

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


Change-Id: If33df1e9b3e93c7aaff30565f6d61dc56c24e491
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-26 22:21:11 +00:00
Keerti Parthasarathy c5ef526828 Test case with workaround for data driven fixes on extensions
Change-Id: I3e6d13ab110b84bd3f87c3bbd84ccb44d9ea5bc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373160
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-26 16:20:18 +00:00
Sam Rawlins 1e84b64a0e DAS: Move DartChangeWorkspace to the analysis_server_plugin package
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I79f43d06b48149b1d9dec30c5f5a77fdfd57ce4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373143
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-26 02:17:59 +00:00
Keerti Parthasarathy bcbe3a54ff Fix bug in AddDiagnosticReference when using it via CLI.
Fixes https://github.com/dart-lang/sdk/issues/55772.

Change-Id: Ic77f67486f71bdfea726ea3161d83728326b2c5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372120
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-20 18:10:32 +00:00
Parker Lougheed 041d4ffd6a [analysis_server] Disallow construction/extension of namespaced enumerations
Change-Id: Ic4279ed0c29649b7ad7ece1e190606fe04f2778f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371504
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-17 15:23:00 +00:00
pq 2e9bd8a967 quick fixes for EXTENSION_{TYPE_}DECLARES_MEMBER_OF_OBJECT
Quick fixes for:

* `EXTENSION_DECLARES_MEMBER_OF_OBJECT`
* `EXTENSION_TYPE_DECLARES_MEMBER_OF_OBJECT

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


Change-Id: I4a3576f7e78c58a4cf7dd6d659b576f2c7f11279
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371686
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-14 20:47:02 +00:00
pq de63980b40 quick fixes for SUBTYPE_OF_{BASE,FINAL}_IS_NOT_BASE_FINAL_OR_SEALED
Quick fixes for:

* `SUBTYPE_OF_BASE_IS_NOT_BASE_FINAL_OR_SEALED`
* `SUBTYPE_OF_FINAL_IS_NOT_BASE_FINAL_OR_SEALED`

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

Change-Id: I1ee373fb030a1570f93e3a7bee694aa0ecc974f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371683
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-14 20:16:46 +00:00
pq 5d3578a2a9 quick fix for WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER
(`error_fix_status.yaml` to be updated when pending quick fixes are landed.)

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

Change-Id: I042f6dc2171a37d008c6c2c4d1f843e0bcffc46c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371662
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-14 19:03:50 +00:00
Danny Tuppeny 1b302b8df0 Move tests for switch enum cases for >= 2.19 from AddMissingEnumCaseClausesTest to AddMissingSwitchCasesTest_SwitchStatement
The tests in this class were duplicated when pattern support was added, one set
of tests for <= 2.19 and one for > 2.19. The> 2.19 tests were marked as Failing
because this functionality didn't work.

This functionality has now been implemented, but because the error code and fix
are different, these tests continued to fail. This change moves the tests to
the equivalent pattern-enabled fixes tests and removes `@FailingTest` for
those that can now pass.

There are still a few marked `@FailingTest` because of differences in the new
implementation.

See https://github.com/dart-lang/sdk/issues/52180#issuecomment-2166814402

Change-Id: Ie1dfa5bc5c608d38a191507f5f0403d20ba2ef31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-14 15:48:51 +00:00
pq 24156d0b67 [wildcards] code folding tests
Fixes: https://github.com/dart-lang/sdk/issues/56009

Change-Id: Iad1f197388d0b89e9bd9b31cc82a496cf578380b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371663
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-14 15:44:19 +00:00
Sam Rawlins 50e4c576b9 analyzer: fix various issues for static extension member resolution
* Unqualified, out-of-scope static extension members are not
  accessible.
* Locally scoped extension members shadow others.
* Static and instance extension members do not conflict.

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

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

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Icd618d044b3857efa24f365c6835d42c0022c176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370323
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-06-14 00:59:57 +00:00