dart2js: always warn when getter is static but setter is not and vice versa, even if they are implicit #14427
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
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
}
The text was updated successfully, but these errors were encountered: