Skip to content

Analyzer should ignore warning on private typedefs #60086

@ChaserVasya

Description

@ChaserVasya

Snippet

void main() {
  final a = fn();
  print(a);
}

_A fn() {
  return 1;
}

typedef _A = int;

Actual

The typedef is unused in a pop-up about declaration.
Image

And unused in a hint about the variable
Image

A warning is provided
Image

Expected

No warning OR using a typedef in a pop-up window.

Let's imagine that fn places in another file. The declaration pop-up uses int. The variable pop-up uses int. User sees _A only if he goes to the file with fn. So, why the typedef triggers analyzer?

Technically private typedef doesn't used anywhere outside of library.

SDK

Dart SDK version: 3.5.4 (stable) (Wed Oct 16 16:18:51 2024 +0000) on "macos_arm64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestlegacy-area-analyzerUse area-devexp instead.triage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions