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
{{ message }}
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
Nice. I'll dupe it as the other bug covers either fix option. I think we're leaning towards restriction first. While runtime fix is pretty easy, it has some bad implications on the generated code.
Looking at the comments, it looks like we didn't intend to support overriding fields at all, even with getter/setter. (It doesn't interact well with separate compilation. Basically has the same issue.)
I wonder if this works, though:
classA {
intget _x =>42;
}
classBextendsA {
int _x =32;
}
main() {
var a =newB();
print(a._x);
}
Activity
jmesserly commentedon Oct 22, 2015
@vsmenon -- that's an illegal field override with field, right?
jmesserly commentedon Oct 22, 2015
in other words, is this a dupe of #52
vsmenon commentedon Oct 22, 2015
Right, if we statically disallow, we could make this a "won't fix".
jmesserly commentedon Oct 22, 2015
Nice. I'll dupe it as the other bug covers either fix option. I think we're leaning towards restriction first. While runtime fix is pretty easy, it has some bad implications on the generated code.
vsmenon commentedon Oct 22, 2015
I'm hitting a different error if I change the override to a getter:
Error is:
vsmenon commentedon Oct 22, 2015
We could statically disallow this as well though.
jmesserly commentedon Oct 22, 2015
good catch! I forgot if that was supposed to be supported or not :)
does it work differently with public fields (I guess probably not)?
jmesserly commentedon Oct 22, 2015
Looking at the comments, it looks like we didn't intend to support overriding fields at all, even with getter/setter. (It doesn't interact well with separate compilation. Basically has the same issue.)
I wonder if this works, though:
That one should work, but might not, because this code looks pretty fishy:
https://github.com/dart-lang/dev_compiler/blob/ed47365eaa6985199555289616b242d2c2878a43/lib/runtime/_classes.js#L289
FWIW, that string concat is semantically meaningless ... the string is only to help debugging.