Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DartVM: Failure of the method lookup for a super invocation causes a compile time error #1244

Closed
DartBot opened this issue Jan 20, 2012 · 5 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@DartBot
Copy link

DartBot commented Jan 20, 2012

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();
}

@dgrove
Copy link
Contributor

dgrove commented Feb 4, 2012

Added Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Feb 6, 2012

This comment was originally written by @mhausner


Set owner to @mhausner.

@DartBot
Copy link
Author

DartBot commented Feb 7, 2012

This comment was originally written by @mhausner


For Test 1 above, I get this on the VM:

Error: line 10 pos 15: function 'func' not found in super class
    super.func();
              ^

Looking at this next.

@iposva-google
Copy link
Contributor

Added Accepted label.

@DartBot
Copy link
Author

DartBot commented Oct 29, 2012

This comment was originally written by @mhausner


This is fixed, we invoke noSuchMethod when we can't find the method in the super class.


Added Fixed label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Oct 29, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

3 participants