Commit Graph

15113 Commits

Author SHA1 Message Date
Konstantin Shcheglov 09550b33fc Issue 57035. Fix for exception when asking class alias constructors.
Bug: https://github.com/dart-lang/sdk/issues/57035
Change-Id: I48aa20815b56c49f08e22509126f74891e694644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 20:24:39 +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
Robert Nystrom 732b07a42b Roll dart_style into the SDK.
I'm still chasing down a couple of google3 failures, but this is ready for review so that I can get it approved and land it once the last couple of failures are fixed. Here is who I think should review what:

athom@ for:

- DEPS

johnniwinther@ for:

- pkg/_fe_analyzer_shared
- pkg/front_end
- pkg/kernel

brianwilkerson@ for:

- pkg/analysis_server
- pkg/analyzer_plugin
- pkg/analyzer_utilities

kenzieschmoll@ for:

- pkg/dartdev

pquitslund@ for:

- pkg/linter/lib/src/lint_codes.g.dart

If you're not the right person, feel free to summon someone else.

Most of the changes here are re-running code generators that auto-format the code they generate. The changes are:

Roll in the latest dart_style commit:

- DEPS

Manually updated these test expectations to expect the new style:

- pkg/analysis_server/test/lsp/format_test.dart
- pkg/analysis_server/test/services/refactoring/agnostic/change_method_signature_test.dart
- pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
- pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
- pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
- pkg/analysis_server/test/src/services/refactoring/convert_selected_formal_parameters_to_named_test.dart
- pkg/analysis_server/test/src/services/refactoring/move_selected_formal_parameters_left_test.dart

This was auto-generated by something, but I'm not sure why it thinks there is a diff:

- pkg/analyzer_plugin/doc/api.html

Updated to require a version of dart_style that accepts a language version in DartFormatter():

- pkg/analyzer_plugin/pubspec.yaml

Updated to always use the latest language version (and thus new style) when invoking the formatter:

- pkg/analyzer_utilities/lib/tools.dart

Manually updated the formatting in the code templates so that they matched the formatting expected by the tests, which implicitly format using the latest language version:

- pkg/dartdev/lib/src/templates/...

The rest are all generated files that are formatted so re-generated using the new style:

- pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
- pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
- pkg/analysis_server_client/lib/handler/notification_handler.dart
- pkg/analysis_server_client/lib/src/protocol/...
- pkg/analysis_server/lib/protocol/protocol_generated.dart
- pkg/analysis_server/test/integration/support/integration_test_methods.dart
- pkg/analysis_server/test/integration/support/protocol_matchers.dart
- pkg/analyzer_plugin/lib/protocol/...
- pkg/analyzer_plugin/test/integration/support/integration_test_methods.dart
- pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
- pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
- pkg/analyzer/lib/src/dart/error/...
- pkg/analyzer/lib/src/error/codes.g.dart
- pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
- pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
- pkg/analyzer/lib/src/summary/format.dart
- pkg/analyzer/lib/src/wolf/ir/ir.g.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_000_1.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_001_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_010_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_100_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/simple/...
- pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
- pkg/front_end/lib/src/codes/cfe_codes_generated.dart
- pkg/front_end/lib/src/util/parser_ast_helper.dart
- pkg/front_end/test/parser_test_listener.dart
- pkg/front_end/test/parser_test_parser.dart
- pkg/front_end/testcases/...
- pkg/kernel/lib/src/coverage.dart generated
- pkg/kernel/lib/src/equivalence.dart generated
- pkg/linter/lib/src/lint_codes.g.dart

Change-Id: Ice0141b763e63b84f54692cd19a442a0719673c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391263
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-06 18:42:25 +00:00
Konstantin Shcheglov 03ad365274 Elements. Use firstFragment in TypeParameterElementImpl2 instead of wrappedElement.
Change-Id: Idf049d7f76d2c197bb6a98063bb7dd2a13c806aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393763
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 17:04:39 +00:00
Konstantin Shcheglov 4f20171f69 Elements. Use more impl in impl and tests.
Change-Id: Ibef3504c701fa3f37eb9078058113d8e44f05f04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-06 16:51:02 +00:00
Sam Rawlins 1d947cedd2 Add new plugins to analysis options signature
Change-Id: Ia8600dfb33e8c65573d92b8643398488037ea63a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393602
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-05 21:02:59 +00:00
Konstantin Shcheglov 53bf3ff846 Elements. Rename to ClassElementImpl2, etc.
Change-Id: I94119f60b5bf01e52cf348a7c67f2b4a5ba62900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-05 18:42:21 +00:00
FMorschel 9d340db3e6 Fixes import prefix hover text as code
R=srawlins@google.com

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

Change-Id: I37fa39f385dd26dfcf55c024b9ca331ec83381f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-05 18:10:19 +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
Konstantin Shcheglov 7b9d11a6a4 Elements. Write mixins / interfaces / etc of InstanceElement2.
Change-Id: I402d76450bb06a74580292777dae4514c2685e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393580
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-05 02:36:18 +00:00
Konstantin Shcheglov 19cac1c907 Elements. Remove 'normalParameterNames' and 'optionalParameterNames' from FunctionType.
Change-Id: I934dca9f635411b71add032a3fc607dddf7de11a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393362
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 23:58:32 +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
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
Konstantin Shcheglov 4f6b07c25e CQ. Remove available declarations.
Bug: https://github.com/dart-lang/sdk/issues/55281
Change-Id: Ie8d2a7f3d5ea9408320312d49eb67561ca463289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393480
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 21:30:08 +00:00
Konstantin Shcheglov c054056146 Elements. Lint. Disallow 'declaredElement' from src/dart/element/element.dart
Also enable the lint for analyzer/.

Change-Id: I2c9e61c6427f5e59b936f1ee7f5f94d4584f2988
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392851
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-04 20:59:51 +00:00
Paul Berry 6ef2dbcb71 Introduce ExtensionResolutionResult for use by ExtensionMemberResolver.
Previously, `ExtensionMemberResolver` used `ResolutionResult` to
return its results. This created unnecessary complexity, because
`ResolutionResult` needs to be able to represent a lot of resolution
results that aren't possible when resolving extensions (references to
`Function.call`, references to record fields, and various complex
error reporting scenarios). Conversely, `ExtensionResolutionResult`
needs to be able to represent some scenarios that arent relevant when
doing non-extension resolution (extension lookup resulting in no
result or an ambiguous result).

Splitting into two classes makes both classes simpler.

In a few cases, code needs to be able to handle either a
`ResolutionResult` or an `ExtensionResolutionResult`; for these cases,
I've added a common base class `SimpleResolutionResult`.

This change paves the way for some clean-up work I'm doing on
`TypePropertyResolver` (which uses `ResolutionResult`).

Change-Id: I205251e43d7263cd2df7c729d1550dbb55980f62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393442
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-11-04 19:49:23 +00:00
pq 6523606849 [element model] fix unsafe member to ExecutableFragment cast
Fixes: https://github.com/dart-lang/sdk/issues/57022

Bug: https://github.com/dart-lang/sdk/issues/57022
Change-Id: Icb00f89089565679109b749d1a43d95f4c8b09b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393401
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 18:47:40 +00:00
Konstantin Shcheglov 4096db4d51 Elements. Create loadLibrary() function with reference, lazily.
Related to https://dart-review.googlesource.com/c/sdk/+/393164

Change-Id: Ia448ff42c9de538be9a8f6f2101dff0c949671d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-04 17:19:46 +00:00
Jens Johansen 817882c36b [parser] Recover missing identifier in new style typedef
Before, when parsing a new style typedef without an identifier (e.g.
`typedef = whatnot`) it concluded that the token after the equal-sign
wasn't an equal sign an that it thus had to be an old style typedef,
followed by recovery there.

This CL makes the recovery insert an identifier after `typedef` (what
the recovery of the old style actually did too), and then parse it as a
new style typedef.

This causes the previous many errors to just be `Expected an identifier,
but got '='.`

It is furthermore verified that the parsing of such a case is ~the same
as when having an indentifier.

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

Change-Id: I5cde1f29839555b1d6027a7d040dc6f60ac614a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392560
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-11-04 11:18:38 +00:00
Konstantin Shcheglov 1a0273672a Elements. Build TopLevelFunctionElementImpl during building elements.
Give it a reference.

Change-Id: Ie1189a18e9d2794d37e530cbbb01ddd86b78a16e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393164
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 22:21:00 +00:00
Konstantin Shcheglov caf3c82f59 Elements. Put element into builders.
Change-Id: Ieb8dbd09783a805e2b67d1bfcb3ace580825f5e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393180
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 20:10:42 +00:00
Konstantin Shcheglov a868303290 Elements. Remove FragmentName, inline as name2 / nameOffset2.
Change-Id: If238cd71867501a39e243261228d137f925db1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-01 18:56:26 +00:00
Brian Wilkerson 06207a74fa Make ParameterMember implement FormalParameterElement
Change-Id: Ibaa74894099e0c8f9e71409f19b8372362c5d728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393045
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 18:45:22 +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
Konstantin Shcheglov c17dd356c1 CQ. Remove most of DeclarationsTracker.
Keep only enough to support DartdocDirectiveInfo.

Change-Id: I228d771b866bd7f0a903b62064f058c9edd04bee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393020
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 15:07:48 +00:00
Konstantin Shcheglov 2d0eedc100 Elements. Keep only AugmentedInstanceElementImpl and subclasses.
Having single implementation of `ClassElement2` (and other elements like it) makes the implementation easier now, and simplifies future changes.

Change-Id: Ifd38a8738fff99b7ac0b387140fdd623be18be01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-01 14:58:14 +00:00
FMorschel 5e6a681445 Fix hover import prefix
Fixes https://github.com/dart-lang/sdk/issues/32735

Change-Id: I6830b61fe554065f9ec6e87f2ac24dfaffd67f35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
2024-11-01 14:16:58 +00:00
Johnni Winther bdacb7d034 [_fe_analyzer_shared] Add evaluateExpression
This adds a helper method that evaluates an [Expression] based on
the semantics that can be deduced from the syntax.

Change-Id: I1b54ee03c1380d337969671133179aa557702a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-11-01 09:26:44 +00:00
Chloe Stefantsova 297c90b50b [analyzer][cfe] Share the constraint collecting procedures
Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: I98dae68a61536cc3292f2a4f05cab22a8014486d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392581
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-11-01 07:38:15 +00:00
Brian Wilkerson 5ef250a2bf Rework the new element model so that all elements have fragments
Change-Id: Ic4fc0368cabc5fa8dfc21c958e1619777f2701b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392541
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-31 23:23:39 +00:00
Kallen Tu 00e4c92a64 [flow] Part 3 Issue 3658 Avoid writing promotion information for postfix inc/dec expressions.
Postfix increment and decrement expressions should not be saving any promotion information.

An example of where saving the promotion information after the write is unsafe is:
```
class A {
  A operator +(int i) {
    return new B();
  }
}

class B extends A {}

main() {
  A x = A();
  if ((x++) is B) {
    // x should not be B
  }
}
```

This change is only for the analyzer because the CFE does something different (converts the postfix increment/decrement into a let expression).

Bug: https://github.com/dart-lang/language/issues/3658
Change-Id: Ic22f69bf79da66965908ade80bdf70399f0bcaa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391494
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-10-31 22:15:14 +00:00
pq 490dc01ad8 [element model] migrate annotate_redeclares
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I7ca6a306d973080a486660a0ace8e1a5b9f50d8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392760
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-31 21:10:49 +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
FMorschel df520c9ee3 [DAS] Import library with prefix
R=srawlins@google.com

Fixes https://github.com/dart-lang/sdk/issues/55863
Fixes https://github.com/dart-lang/sdk/issues/41515
Fixes https://github.com/dart-lang/sdk/issues/24338

Change-Id: I8b8457488b55a468d4b3c6d34efffc7436a2ff18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389780
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-31 16:57:03 +00:00
Sam Rawlins 09b4ec7445 analyzer: Fix 40 broken comment references
Change-Id: I91c6ae9473cc6cdde1b5131a349c2701e51a1aaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392800
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-31 16:28:07 +00:00
Sam Rawlins 52001ff5ac analyzer: Support a list of included analysis options
Fixes https://github.com/dart-lang/sdk/issues/47256

See specified behavior at https://github.com/dart-lang/sdk/issues/47256#issuecomment-2374880529

Additionally:

* Make AnalysisOptionsProvider.sourceFactory private and final,
  which allows for promotion, yay!

Change-Id: I26e0e73c661d48189078be95ff544fe8dfb7a86d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-30 22:08:49 +00:00
Sam Rawlins 1db40b6eb8 analyzer: Add an AnalysisRule alias for LintRule
Since the LintRule class is the basis for writing both "lint rules"
(rules that must be explicitly enabled) and "warning rules" (rules that
are enabled by default), it is a misnomer to use 'LintRule' as a
supertype. This change adds an alias, 'AnalysisRule'. Additionally:

* Rename LinterVisitor to AnalysisRuleVisitor.
* Rename lintRuleTimers to AnalysisRuleTimers.
* Rename LinterExceptionHandler to AnalysisRuleExceptionHandler.
* Rename LintRuleExceptionHandler to _AnalysisRuleExceptionHandler.

* NodeLintRegistry is used in too many places, so I have left it for
  now.

Change-Id: I43340cca0f9b64502960d8f5e05c6c9b81c3dfd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392203
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-30 17:43:19 +00:00
Konstantin Shcheglov 2c3ff3fefb Elements. Remove augmentation properties/accessors relinking information.
We now write and read library fragments in the correct order, so
declarations are always read before augmentations.

Change-Id: I5a35cf8d963c3a5010344361289d3be4dc5b7f11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392620
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 17:33:39 +00:00
FMorschel a40403e0fb [DAS] New assists for wrap with Expanded/Flexible
R=pquitslund@google.com

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

Change-Id: I34a697d914e3a480105a4388d77178a96425893a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390622
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-30 17:26:18 +00:00
Sam Rawlins 10759dde14 Update comments about context types and inference
A follow-up from Konstantin's comments here:
https://dart-review.googlesource.com/c/sdk/+/392501

Change-Id: I19853831d304c2ea3267969e99249ff356aad3ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392600
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 17:24:34 +00:00
Samuel Rawlins 81f4b71293 Reland "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b3f31a0440.

Reason for revert: Customer tests are now disabled.

Original change's description:
> 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>

Change-Id: Icbe69690e83daecc5a0649d2f632ffc33ba6394c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-30 16:56:16 +00:00
Sam Rawlins 26cbe65188 analyzer: Correct 40 comment references
There are fewer than 140 `comment_references` violations after this
change.

Change-Id: I1d19db7e293b43400a6e076945d84f509862f873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-30 16:18:14 +00:00
Sam Rawlins 471c2251c1 analyzer: Remove unused ExceptionInDelegateHandler typedef
Change-Id: Ib9c992d480b5c20cb90fabb0ebe90cbab2af4a12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392407
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 16:14:10 +00:00
Konstantin Shcheglov 3cd077122e CQ. Remove AnalysisDriver._accumulatedAffected, never written.
Change-Id: Ied0120823ed8b20eb0dc72143435cf1e15907ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392480
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-29 22:15:41 +00:00
Konstantin Shcheglov 55154ecc9c Elements. Remove 'augmentedIfReally'.
Change-Id: Id6ebeaea49627de09207c96652c600116b71c5bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392500
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-29 22:11:19 +00:00
Sam Rawlins 998cd101b8 analyzer: Correct comment references in some source files
This corrects about 40 of 220 comment_references issues in the analyzer
package.

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

Change-Id: I0c2ec602262121337e7305797596fac9df987973
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-29 21:38:34 +00:00
Konstantin Shcheglov 78edbe3f12 Elements. Set augmentationTargetAny / augmentation during reading.
Change-Id: Ia2cd8e680bb83cd45c08d2fae3d4e38a3f6935ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392464
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-29 20:38:49 +00:00
pq 265b6c8b7c [element model] migrate await_only_futures
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I280d5b1a93a0944208c976a51e6d0be007e2e4aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387325
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-29 20:33:52 +00:00
Konstantin Shcheglov 84e15e9efb Issue 56355. Fix token cycle via 'previous'.
Bug: https://github.com/dart-lang/sdk/issues/56355
Change-Id: I1ee7f837dc8beed9bb2ed1f27c45108345e7cceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-29 20:12:41 +00:00
Konstantin Shcheglov aec93bfaad Elements. Use 'firstFragment' instead of 'declaration' in AugmentedInstanceElement and subtypes.
Change-Id: Idc3812ebc51f0bf92f467f21d91f7f4ecb3171e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-29 20:02:00 +00:00