You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The specification gives setters a separate name from getters, and name lookup of one does not interact with the other.
We currently assume that a getter (e.g., a final field) on a class introduces a "property", and that writing to the name fails due to a missing corresponding setter.
Instead writing to the name should skip the getter declaration completely and look further out for a setter for the name.
example:
set x(v) { print("OK"); };
class A {
static final x = 42;
static foo() { x = 10; }
}
main() => A.foo();
This program should print "OK" according to the specification. It currently reports that x is not assignable because the 'x' in the assignment is matched with the 'x' declaration in the class, and not the 'x setter' in the top scope.
The text was updated successfully, but these errors were encountered:
The specification gives setters a separate name from getters, and name lookup of one does not interact with the other.
We currently assume that a getter (e.g., a final field) on a class introduces a "property", and that writing to the name fails due to a missing corresponding setter.
Instead writing to the name should skip the getter declaration completely and look further out for a setter for the name.
example:
set x(v) { print("OK"); };
class A {
static final x = 42;
static foo() { x = 10; }
}
main() => A.foo();
This program should print "OK" according to the specification. It currently reports that x is not assignable because the 'x' in the assignment is matched with the 'x' declaration in the class, and not the 'x setter' in the top scope.
The text was updated successfully, but these errors were encountered: