Skip to content

dart2js: Reflective superclass access fails for classes with mixin invocations in their superclass chain #12055

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

Closed
jmesserly opened this issue Jul 26, 2013 · 6 comments

Comments

@jmesserly
Copy link

this is the dart2js bug corresponding to VM bug:
https://code.google.com/p/dart/issues/detail?id=9434

given:

library test;
import 'dart:mirrors';

class FooMixin {
  foo() => print('foo');
}

class Qux {
  qux() => print('qux');
}

class Bar extends Qux with FooMixin {
  bar() => print('bar');
}

main() {
  var b = new Bar()..foo()..bar()..qux();

  var mirror = reflect(b);
  for (var type = mirror.type;
    // Note: checking qualifiedName here to workaround bugs with the superclass of Object
    type.qualifiedName != const Symbol('dart.core.Object');
    type = type.superclass) {
    print('> ${type.qualifiedName}');
    for (var i in type.superinterfaces) {
      print(' + ${i.qualifiedName}');
    }
  }
}

VM (after fix) outputs:

foo
bar
qux
> Symbol("test.Bar")
> Symbol("test.Qux&FooMixin")
  + Symbol("test.FooMixin")
> Symbol("test.Qux")

dart2js outputs:

foo
bar
qux
> Symbol("test.Bar")
out.js:4012: UnimplementedError
  throw $.wrapException(ex);
          ^
Error
    at wrapException (out.js:4002:11)
    at throwExpression (out.js:4012:11)
    at JsClassMirror.get$superinterfaces (out.js:9109:14)
    at Closure$main.main as call$0
    at _IsolateContext.eval$1 (out.js:2291:21)
    at startRootIsolate (out.js:1945:15)
    at out.js:28559:7
    at out.js:28756:3

@peter-ahe-google
Copy link
Contributor

I'm not sure how this is different from 11863.


Added Duplicate label.
Marked as being merged into #11863.

@peter-ahe-google
Copy link
Contributor

The difference is:

class Bar extends Qux with FooMixin {

vs:

class Bar extends Qux implements FooMixin {


Added Accepted label.
Marked as being merged into #.

@peter-ahe-google
Copy link
Contributor

Marked this as blocking #6490.

@peter-ahe-google
Copy link
Contributor

@peter-ahe-google
Copy link
Contributor

The issue about superinterfaces is tracked in issue #11863.

Fixed in r26162.

Caveat: the name of the anonymous mixin application is broken (test.null) unless you use:

@MirrorsUsed(targets: 'test')
import 'dart:mirrors';

That is being tracked in issue #12464.


Added Fixed label.

@peter-ahe-google
Copy link
Contributor

Set owner to @peter-ahe-google.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants