Closed
Description
This issue was originally filed by [email protected]
Ran this on our latest VM build, no compile error.
Spec ch. 7.5.1 says: Let k be a generative constructor. [...] It is a compile-time error if more than one initializer corresponding to a given instance variable appears in k's initializer list.
However, in the following example:
class C {
C() : x = 1, y = 2, this.x = 3;
var x;
var y;
}
main() {
try {
C c = new C();
print(c.x);
} catch(var x) {}
}
no compile-time error occurs and both initializers are executed, which is evident after print().
other constructor variations:
C() : x = 1, y = 2, x = 3;
C(x, y) : this.x = x, this.x = y;
demonstrate the same behaviour