-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).Dart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reportClosed in favor of an existing reporttype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
to reproduce:
1 class A {
2 A(x) {}
3 }
4 class B extends A {
5 var _x;
6 B(this._x) : super(_x);
7 }
8 main() {
9 new B(1);
10 }
this yields
'error: line 6 pos 22: illegal implicit access to receiver 'this'
B(this._x) : super(_x);
on line 6, apparently _x refers to the instance variable, instead of to the constructor parameter.
maybe it would make more sense for _x used as an r-value inside a constructor initializer to refer to the
constructor parameter and _x used as an l-value to refer to the instance variable. e.g.
B(x) : x = 1; // assign 1 to the instance var x
B(x) : y = x; // assign the passed in x to the instance var y
Dart VM version: 1.0.1.1_r30601 (Fri Nov 22 17:38:17 2013) on "linux_x64"
Metadata
Metadata
Assignees
Labels
area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).Dart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reportClosed in favor of an existing reporttype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)