Skip to content

Improve error message for typo in setter name #48603

@rkj

Description

@rkj

Code like this:

class A {}

class B {
  A _a;
  A get a => _a;
  set A(A a) => _a = a;
}

gives error:

Error: 'A' isn't a type.
  A _a;

which is a little confusing, as the type is clearly defined above. It took me a long while to find out what is the actual issue (I first thought incorrect import / conflicting names imported).

It also causes analyzer to highlight all the places except where the actual problem is:
8pTMspp9ZPUtgWb

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)devexp-uxtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions