Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No static warning if class has implicitly declared static getter and an explicitly declared instance setter with the same name #24534

Closed
sgrekhov opened this issue Oct 9, 2015 · 1 comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sgrekhov
Copy link
Contributor

sgrekhov commented Oct 9, 2015

Specification (3rd Edition, June 2015) states (10.2 Getters):

It is a static warning if a class declares a static getter named v and also
has a non-static setter named v =. ... These warnings must be issued regardless of
whether the getters or setters are declared explicitly or implicitly.

Look at the following program:

class C {
  static int v;
  set v(int v1) { /// static type warning
  }
}

main() {
  C.v;
}

There are instance setter and implicitly defined static getter. But dartanalyzer produces
[error] The name 'v' is already defined

No static warning reported

@bwilkerson bwilkerson added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Oct 9, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@askeksa-google
Copy link

This is now an error, and the analyzer produces an error. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants