Commit Graph

390 Commits

Author SHA1 Message Date
Sam Rawlins 43e01310a4 analyzer_testing: Rename PubPackageResolutionTest.ignoredErrorCodes to ignoredDiagnosticCodes
Change-Id: I0a951ecbf8aa74d1c00df99e0f5bdab84bb00dde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430542
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-23 10:12:18 -07:00
Sam Rawlins 9d2df84973 analyzer_testing: add more default-ignored codes
UNUSED_ELEMENT and UNUSED_FIELD were added to the "ignore list" for
the tests of a dozen lint rules. I think it is pretty harmless to ignore
them by default, and save plugin authors some `// ignore:` comments, or
hand-wringing about how to get rid of an "unused" field in a test which
is needed in order to test an analysis rule.

Change-Id: Ic35fead8a44d8d3341f9e32e92b53610b517edf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430121
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-05-22 09:23:50 -07:00
Sam Rawlins 3a08da01af analyzer: Support comment references of members of aliased type
Work towards https://github.com/dart-lang/sdk/issues/56109
(specifically support for
https://github.com/dart-lang/sdk/issues/56109#issuecomment-2292355457).

Currently, instance (and static) members of a type can be referenced in
a comment reference. This change adds support to referencing instance
(and static) members of a type via a type alias.

Change-Id: Ic789a0185cb8c56236346ef3ae658481fbd4cd70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429226
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-20 11:35:29 -07:00
Sam Rawlins f81079035f analyzer_testing: Move LintRuleTest and linter's PubPackageResolutionTest
Most of the behavior of LintRuleTest is extracted into a public class
in analyzer_testing, AnalysisRuleTest. A little bit of code is left in
LintRuleTest, so that first-party lint rules can be tested by
registering the first-party lint rules. And those lint rules can
declare the `lintRule` that each is concerned with, rather than the
new `analysisRule` getter.

PubPackageResolutionTest is left as private impl, because I think it
may undergo some changes, and we may be merging more shared code, and
the name may change. A few first-party lint rules have tests that
refer to this class, which is OK.

Other than that, no code or behavior changes are in this CL.

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

Change-Id: I447850c438af7d0fe90889d2eaec6f2f8b4f8281
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-20 10:25:50 -07:00
FMorschel 83eb816e51 [linter] Adds new switch_on_type lint
Fixes: https://github.com/dart-lang/sdk/issues/59546
Change-Id: Ib78714e03c1487376c961214910d10c24ec9f8ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-05-16 16:00:54 -07:00
Sam Rawlins dfaf1514ea linter: discarded_futures: do not report on await-in-synchronous function
When a synchronous function body has an `await` expression, we report
an error. We don't need to _also_ report a lint.

The noted error, `CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT`, already
is associated with the "add async" fix. Reporting a lint when an error
is also definitely reported is just double reporting.

Change-Id: If6d260a01cc654c87897480996d3f6f4b61373dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-16 15:34:20 -07:00
Konstantin Shcheglov 2db49488c1 CodeGen. Generate members of most leaf AstNodeImpl classes.
Every declaration annotated with `@generated` was generated. In the
current version there are `2180` such declarations. For comparison,
there are `2167` instances of `@override` in total, and `@generated +
@override` has `1576` instances, so we generate `72%` of all overrides.

The generator automatically formats and sorts `ast.dart` after applying
changes, so the result is nice and clean. We run a separate DAS instance
from the script to do this.

Things to improve in the future:

1. Generate for non-leaf classes.

2. Support for `DoNotGenerate`.

Change-Id: I05e6356c9aac68449d5117ad8fd533735f130c73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-15 18:05:42 -07:00
Sam Rawlins bd700772ff analyzer: move testing utilities to analyzer_testing package
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: Iae062d95e5cf3b94b540496242b3627268ac2612
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428844
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-15 16:28:50 -07:00
Sam Rawlins 06d2071504 linter: Remove an export before it becomes cross-package
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: I5ffe612695be725e0af0497f9b2917da3d52ec7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428420
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-14 07:12:19 -07:00
Sam Rawlins 27e819f4cc linter: combine test classes into one
Work towards https://github.com/dart-lang/sdk/issues/55660

The only direct subclass of `_ContextResolutionTest` is
`PubPackageResolutionTest`, so they can be combined. I keep all of the
API the same, with a few exceptions:

* Make `addTestFile`, `testFilePath`, `resolveTestFile` private. They
  were very lightly used outside of `rule_test_support.dart`, in
  exceptional situations, where they can be replaced with local members.
* This allows for a much more idiomatic impl for `file_names_test.dart`.

Change-Id: Icfa63ca488c4722067fc7d471343afd398a9dddc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-12 16:50:59 -07:00
Paul Berry a757d2af41 Enable sound-flow-analysis for Dart 3.9.
Bug: https://github.com/dart-lang/sdk/issues/60438
Change-Id: I908d4e4a9143142281d8198870f40eba6cf6f67f
Tested: trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427500
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-09 14:50:26 -07:00
Sam Rawlins f2d4ca7968 linter: unawaited_futures: catch Future subtypes
Change-Id: Iabdfc1ec4984d6717cc3d85729b577fb2385e749
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 11:04:36 -07:00
Sam Rawlins 3021cc4913 analyzer: Move PackageConfigFileBuilder to public API.
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: I3df2cd374f6b3ef9e027f0e07c748be6ea21ebb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427586
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 10:57:55 -07:00
Sam Rawlins f9c5944a33 linter: public_member_api_docs: dont report internal top-level variable
Fixes https://github.com/dart-lang/sdk/issues/60617

This includes a bit of clean-up of the other cases where we are concerned with
`@internal`.

Change-Id: I506725c2280ab90fd5e1014eb8478497de8a0480
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-08 07:39:53 -07:00
Sam Rawlins b6508124a4 linter: add unnecessary_unawaited lint rule
Work towards https://github.com/dart-lang/sdk/issues/46218

Change-Id: I0c6953463d053205cc1110f554578e6b85eac0db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426240
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-02 14:36:20 -07:00
Sam Rawlins a913c61186 linter: Use new DiagnosticCode name
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I3f53e1c7db21047665e1a286673d624c2d48c834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-01 07:47:38 -07:00
Erik Ernst 2f0cbeb485 Report type parameters whose name is a type in scope
See https://github.com/dart-lang/sdk/issues/59517 for background and discussion.

Change-Id: I6d02d07cdd95e8b2b647cf3f7f87a9f27a1c48b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-01 04:04:30 -07:00
Sam Rawlins 7d1c867f42 linter: Fix await_only_futures: Fix for type variables and intersection types
Fixes https://github.com/dart-lang/sdk/issues/58492

Change-Id: Iae036742b05815332553a540c95b4fdf5ad83413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425402
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-29 17:44:59 -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 5828f83e57 linter: Support for inherited @awaitNotRequired annotations
Change-Id: I6c55f6423f6a44838674165ab311f31c64ffd399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424682
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-25 09:20:39 -07:00
Sam Rawlins 0501720890 linter: Consider @awaitNotRequired in the discared_futures rule
Work towards https://github.com/dart-lang/sdk/issues/46218

Change-Id: I9e356ab28996351d2ebfb15f655816f35a825339
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-24 11:29:53 -07:00
Ben Konyi 85227c4492 [ Analyzer ] Add diagnostics for Flutter Widget Previews
The Flutter Widget Previewer relies on code generation to import code from
a developer's project into a generated 'widget preview scaffold' that lives
in the project's '.dart_tool' directory. The nature of this implementation
means that any symbols referenced in the declaration of the preview (e.g.,
in the invocation of the `Preview(...)` constructor or the name of the
preview function) must be publicly accessible from outside the library in
which they are defined. One of the main uses for this diagnostic is to flag
usages of private symbols within preview declarations.

These diagnostics also ensures that the `@Preview(...)` annotation can only be
applied to a functions or constructors that:

  - Are statically accessible (e.g., no instance methods)
  - Have explicit implementations (e.g., not abstract or external)

Fixes https://github.com/flutter/flutter/issues/167193

Change-Id: I208c7f18c8d4ad826fed46a0dc625d090ff186ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423860
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-04-24 11:15:59 -07:00
Sam Rawlins 41461344d5 analyzer/linter: Support an @awaitNotRequired annotation
Work towards https://github.com/dart-lang/sdk/issues/46218

This implements the bulk of the `@awaitNotRequired` support as specified here: https://github.com/dart-lang/sdk/issues/46218#issuecomment-2725895048

Remaining work:

* implement inheritence
* report a badly-placed annotation
* add the annotation to the real meta package

Change-Id: Ida16018746704d0baa165ab9be95187b52a79061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423923
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-23 10:53:39 -07:00
Sam Rawlins 5eef8e4ebe analyzer etc: move analysisOptionsContent function to be shared
This function was defined once in analyzer testing code, once in
linter testing code, and once in analysis_server testing code. In this
change, all three are combined into one function in analyzer_utilities.

Change-Id: Ib2daa7b3d14aae6ca2aa09f6f9bdeaf76bc72d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423068
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-21 13:01:36 -07:00
Konstantin Shcheglov 6faefb6db1 Elements. Remove test for analyzer_use_new_elements
It becomes a source of problems while removing V1 element model.
See https://dart-review.googlesource.com/c/sdk/+/422880

I decided to keep the implementation for now, just in case we use V1
accidentally. But we should not change it anymore, because we will not
have tests after this CL.

Change-Id: Iabdab21e12b4142c2df37876df5d7128988c5ded
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-17 12:48:06 -07:00
Konstantin Shcheglov 90a5e71787 Lint. unnecessary_this. Report for this.foo() of the same class.
Change-Id: I55fe9d08fd8d9985f992c7b2cda6376efb8386be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421421
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-16 12:57:12 -07:00
Ben Konyi 5ec368622c [ Linter ] Don't mark functions annotated with @Preview() as unreachable from main
Fixes https://github.com/flutter/flutter/issues/167195

Change-Id: Ie98a0fd5c1b69771b7e9e9cb54c33bfa403381e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-04-15 14:06:09 -07:00
FMorschel 59ceb55042 [linter] Fixes unnecessary_this false negative inside if case
Fixes: https://github.com/dart-lang/sdk/issues/60514
Change-Id: I934f22461b395177eca0046b0bf8797067ccbe46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-04-11 10:22:44 -07:00
Konstantin Shcheglov 45fa7284cb Elements. Deprecate InterfaceTypeImpl.element
Change-Id: Iff7d90a8d614a6069ec7f13810c8bd6600cfcc1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418919
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-01 14:38:38 -07:00
Konstantin Shcheglov 0fda5de36a Elements. Deprecate ClassElement.
Change-Id: I0bf4a73bacc4917d4f61c91bcdceba41a9c18ec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418903
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 11:09:38 -07:00
FMorschel cd54936eb8 [DAS] Fixes broken discarded futures tests
Bug: https://github.com/dart-lang/sdk/issues/59887
Change-Id: I6c8204771b70d49091f882e5b7f875b158724b89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417900
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-03-25 13:09:48 -07:00
FMorschel b855b9ada3 [DAS] Fixes discarded_futures assignment to future parameters
R=pquitslund@google.com

Bug: https://github.com/dart-lang/sdk/issues/59887

Fixes: https://github.com/dart-lang/sdk/issues/59504
Fixes: https://github.com/dart-lang/sdk/issues/58889
Fixes: https://github.com/dart-lang/sdk/issues/59455
Fixes: https://github.com/dart-lang/sdk/issues/59151
Fixes: https://github.com/dart-lang/sdk/issues/59387
Fixes: https://github.com/dart-lang/sdk/issues/59331
Fixes: https://github.com/dart-lang/sdk/issues/59949

Change-Id: I6d93a36f626650b744e2e4ec52bbefe171483820
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403901
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-25 09:15:22 -07:00
Sam Rawlins 5c1b9086c0 linter: Document and test more specifically what the rule does
In preparation for the `@awaitNotRequired` annotation, I looked into
the implementation of this rule, and changed the documentation to be
more specific about the very specific situations in which lints are
reported (there are only three). This should alleviate issues like
https://github.com/dart-lang/sdk/issues/60006.

I also added some test cases that will be useful in exploring what the
new annotation will be able to suppress.

Change-Id: Iea3a90b6c79df4b8eee7c33063780b3cf0298109
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415780
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-19 07:20:45 -07:00
Sam Rawlins 934b7b4c3a Add some avoid_dynamic_calls tests for Function-calls
Change-Id: I98a68940a52530978733e75e2a8d09009ac5fd9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414921
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2025-03-12 09:41:58 -07:00
Konstantin Shcheglov 02db34a691 Elements. Remove most of AugmentableElement, rename to AugmentableFragment.
Change-Id: Ied24bb46b4b4a74cd06c69c5002e0b32edbdf70f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414582
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-11 14:49:59 -07:00
Konstantin Shcheglov 877e8de91a Elements. AugmentedInstanceElement remove fields, accessors.
Change-Id: Icaa3d0dcdd6aeea8c180e21e407091639c791020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414186
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-10 08:56:01 -07:00
Sam Rawlins 68d05068aa analyzer: Extract out two common utilities for URIs
* Uri.isSamePackageAs(Uri) and Uri.isImplementation are each used a
  few times. Not as much as I would expect, but this still simplifies
  some code.

Change-Id: Ie9020916c793852a0df9d04154420948d942d951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413801
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-10 08:26:12 -07:00
Konstantin Shcheglov 283d3154a5 Elements. AugmentedExtensionTypeElement remove primaryConstructor, representation, typeErasure.
Change-Id: I01c654429367575cf40e1cc41165aa6f7652a8c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414201
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-07 22:43:57 -08:00
Konstantin Shcheglov 79ab37f4cd Elements. Remove constructors from AugmentedInterfaceElement.
Change-Id: If49bf51b36c0a638ed0b1052a5cc85edb0b7a1b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414181
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-06 16:39:37 -08:00
Konstantin Shcheglov 6a7fd7cedb Elements. Remove from AugmentedInterfaceElement 'interfaces' and 'mixins'.
Change-Id: I95d4d11c0a5b0a5ccbfe7890f87cf3836a7a39f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-06 13:30:33 -08:00
Konstantin Shcheglov 4bd9df1e2b Elements. Remove support for augmentations and methods.
We don't support augmentations feature yet, and it turned out to be
complicated finishing migration while keeping the current implementation.

Change-Id: I035ecfa74cc107bd9d21a935f76d92987835f542
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413940
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-03-06 09:26:29 -08:00
Erik Ernst 7f43b34b6b Adjust hasObviousType to include negated numeric literals
Bug: https://github.com/dart-lang/sdk/issues/60243
Change-Id: I51509ef84d4b65f68b2ae84cce8ba12894666292
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2025-03-05 00:04:18 -08:00
Konstantin Shcheglov 5bf9bdb496 Elements. Deprecate V1 getters in src/dart/ast/ast.dart
Change-Id: I072b119e2e5b49eb0a286bd805d8280448ca9782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-03 15:55:30 -08:00
Konstantin Shcheglov 0046ae8a46 Elements. Migrate lib/error/listener.dart
Change-Id: I22ce676d84ff95cf8de485bf2fc91e31f0c27807
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-03 10:02:20 -08:00
pq 01c09b3c52 [CQ] [testing] mock support for test_reflective_loader
Change-Id: I6db62d6adb03576763f65157a45227b884937b17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412804
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-02-28 11:13:44 -08:00
pq 1b70bb8651 [CQ] [linter] unify test package dependency creation
As previously implemented, we were creating a new package config builder if we wanted a dependency on `package:reflective_test_loader` which would clobber any previously contributed dependencies. Beside being confusing, this means that you can't have tests that require `package:reflective_test_loader` and any other dependency (such as, for example, `package:meta`).

This fixes that.


Change-Id: Ia16b6c66f6a93a01f8dfa67c871877692414e03b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412801
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-28 09:08:39 -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
pq a30dc8934f [CQ] [linter] de-duplicate reflectiveTestLoader handling
De-duplicate `reflectiveTestLoader` detection and testing

Change-Id: Ia125bd10638b76452583b1a79c69884edcd9c72d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412666
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-27 11:52:17 -08:00
pq 92a6a2c1d5 [PE] [linter] refine strict_top_level_inference reflective test detection
Change-Id: Ifac4d96e0d1340c31cf965c8076ed0acae018d53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412460
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2025-02-27 07:21:16 -08:00