Constructor initialiser list: the compiler doesn't fail when the initialisation list contain many initialisation fot he same instance variable #485
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
This issue was originally filed by [email protected]
Tested on Dartboard and dart vm on macos lion and I receive the same result
I was playing with the object creation in dart. In the version 0.05 of
the language spec I came across to the frase:
"It is a compile time error if more than one initializer corresponding
to a given instance variable appears in k's initializer list"
this is the code I try to run: (http://try.dartlang.org/s/lWMg)
class Test {
int _x, _y;
Test():this._x=0, this._x=1, this._x=2 {}
dump() {
print('x: ${_x} y: ${_y}');
}
}
main () {
var x = new Test();
x.dump();
}
From my understanding this should throw an exception as i try to
initialise few times the same instance variable.
and probably this statement doesn't work as well:
"It is a compile-time error if k's initializer list con-
tains an initializer for a variable that is initialized by means of an initializing
formal of k"
http://try.dartlang.org/s/QL4g
The text was updated successfully, but these errors were encountered: