Closed
Description
cc: @peter-ahe-google @mraleph
tools/test.py -cdartk vm/dart/redirection_type_shuffling_test/none
The Dart source of the test is pretty simple. It has a redirecting factory constructor (with type arguments) and it uses mirrors:
class G<A extends int, B extends String> {
G();
factory G.retain() = G<A,B>;
}
main() {
ClassMirror cm = reflect(new G<int, String>()).type;
Expect.isTrue(cm.newInstance(#retain, []).reflectee is G<int,String>);
}
There are at least two problems here. (1) Fasta is generating an invalid expression in the body of the redirecting constructor:
class G<A extends core::int, B extends core::String> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::G::retain];
constructor •() → void
: super core::Object::•()
;
static factory retain<A extends core::int, B extends core::String>() → dynamic
let final dynamic #t1 = self::G::• in invalid-expression;
}
static method main() → dynamic {
mir::ClassMirror cm = mir::reflect(new self::G::•<core::int, core::String>()).type;
exp::Expect::isTrue(cm.newInstance(#retain, <dynamic>[]).reflectee is self::G<core::int, core::String>);
}
and (2) the VM's Kernel->flow graph translator is not prepared to handle the tearoff of the constructor self::G::•
. It assumes that this can't occur.