DartVM: Failure of the method lookup for a super invocation causes a compile time error #1244
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]
In the section 10.14.3(Super invocation) specification says:
"If the method lookup has failed, then let g be the result of looking up getter m in S with respect to L. If the getter lookup succeeded, let vg be the value of the getter invocation super.m. If vg is a function then it is called with the evaluated argument list. The value of i is the value returned after vg is executed. If vg is not a function then an ObjectNotAClosure is thrown.
If getter lookup has also failed, then a new instance im of the predefined interface InvocationMirror is created by calling its factory constructor with arguments m, this, [o1, ... , on] and fxn+1 : on+1, ... , xn+k : on+kg. Then the method noSuchMethod() is looked up in S and invoked with argument im, and the result of this invocation is the result of evaluating i."
In DartVM the compilation fails if the method lookup has failed.
Test1:
class S {
var func;
}
f() => 1;
class A extends S {
test() {
func = f;
super.func();
}
}
main() {
new A().test();
}
Test2:
class S {
var m;
}
class A extends S {
test() {
try {
super.m();
} catch(ObjectNotClosureException e) {}
}
}
main() {
new A().test();
}
Test3:
class A {
test() {
try {
super.m();
} catch(NoSuchMethodException e) {}
}
}
main() {
new A().test();
}
The text was updated successfully, but these errors were encountered: