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
classA {}
classBextendsA {
intfoo() =>0;
}
classC {
C(this.a);
A a;
}
voidmain() {
var c =C(B()); // Breakpoint here
}
Now you try to evaluate c.a.foo() it gives you an error message about foo not being defined for A. But if you do (c.a as dynamic).foo() everything works normally and it can result in 0 here.
Could the evaluations do something like this internally?
Right now evaluated expression are compiled as Dart code. So you can only do things which are expressible in Dart.
We used to compile expressions without preserving static types (e.g. c would be dynamic and consequently c.a would be dynamic as well), but that hits a problem that any features which rely on static type and type inference (e.g. extensions and extension types or generics) don't work as one would expect.
Making c.a.foo work reliably across all possibilities requires some sophisticated machinery because it requires parser to somehow be able to introspect runtime state.
Say you have
Now you try to evaluate
c.a.foo()
it gives you an error message aboutfoo
not being defined forA
. But if you do(c.a as dynamic).foo()
everything works normally and it can result in0
here.Could the evaluations do something like this internally?
// CC @DanTup
The text was updated successfully, but these errors were encountered: