[M] Change in dart/sdk[main]: analyzer: Mark types specified in type arguments and variable declara...

0 views
Skip to first unread message

Konstantin Shcheglov (Gerrit)

unread,
1:57 PM (7 hours ago) 1:57 PM
to Samuel Rawlins, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Samuel Rawlins

Konstantin Shcheglov voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2cc96f4729c8a143039931039f37caf1f6c8e30f
Gerrit-Change-Number: 480760
Gerrit-PatchSet: 2
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Tue, 17 Feb 2026 18:57:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
1:59 PM (7 hours ago) 1:59 PM
to Konstantin Shcheglov, Commit Queue, dart-analys...@google.com, rev...@dartlang.org

Samuel Rawlins voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2cc96f4729c8a143039931039f37caf1f6c8e30f
Gerrit-Change-Number: 480760
Gerrit-PatchSet: 2
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Tue, 17 Feb 2026 18:59:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
1:59 PM (7 hours ago) 1:59 PM
to Samuel Rawlins, Konstantin Shcheglov, dart-analys...@google.com, rev...@dartlang.org

Commit Queue submitted the change

Change information

Commit message:
analyzer: Mark types specified in type arguments and variable declarations as "used"

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

The rules of when a NamedType was considered a "usage" of a type were
getting too complex and silly to be coherent. I had previously been
attempting to carve out the places where it seemed like a private type
couldn't be used unless it was instantiated. But then `@JS`-annotated
objects were an exception, and now classes that extend `NativeType` are
an exception, if used in a type argument.

But those exceptions are not simple, because the type usage could
come from inference, and so the NamedType might appear in a variety of
places.

This changes simplifies the notion of whether a NamedType constitutes
a usage. We keep only the "inside an is-expression" exception. This
can be seen in the test changes: NamedType in variable declaration now counts as usage.
Change-Id: I2cc96f4729c8a143039931039f37caf1f6c8e30f
Reviewed-by: Konstantin Shcheglov <sche...@google.com>
Commit-Queue: Samuel Rawlins <sraw...@google.com>
Files:
  • M pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
  • M pkg/analyzer/test/src/diagnostics/unused_element_test.dart
Change size: M
Delta: 2 files changed, 67 insertions(+), 81 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Konstantin Shcheglov
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2cc96f4729c8a143039931039f37caf1f6c8e30f
Gerrit-Change-Number: 480760
Gerrit-PatchSet: 3
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages