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

dart2js: always warn when getter is static but setter is not and vice versa, even if they are implicit #14427

Closed
gbracha opened this issue Oct 25, 2013 · 5 comments
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@gbracha
Copy link
Contributor

gbracha commented Oct 25, 2013

The following code should issue a warning, because the class has a getter v and a static setter v is declared in the superclass. I assume this has not been implemented because the getter is implicit and so perhaps the spec was unclear. I will make this requirement explicit. The relevant text now reads:

7.2:

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

and 7.3:

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

class SuperclassMutableStaticVariable {
  static var v = 0;
}

class SuperclassMutableStaticVariableVsInstanceFinal extends SuperclassMutableStaticVariable {
  final v = 200; // warning: getter conflicts with static variable in superclass NOT reported
}

Likewise the analogous

class SuperclassStaticSetter {
  static set s(int x) => sink = x;
}

class SuperclassStaticSetterVsInstanceFinal extends SuperclassStaticSetter {
  final String s = "abc"; // warning: getter conflicts with static setter in superclass NOT reported
}

@kasperl
Copy link

kasperl commented Oct 30, 2013

cc @karlklose.
cc @johnniwinther.
Added this to the M8 milestone.
Removed Priority-High label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M8 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@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 triaged labels Feb 29, 2016
@askeksa-google
Copy link

This combination is legal in Dart nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants