-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Description
I'm working on a fix for #46784. My CL in-progress is at https://dart-review.googlesource.com/c/sdk/+/208881. After patching in the CL I observe a puzzling behaviour when running the follwoing program:
class A<X extends num> {
void f<Y extends X>(Y y) {}
}
main() {
A<num> a = new A<int>();
void Function<Y extends int>(Y) f = (a as A<int>).f;
print(f.runtimeType);
}After patching in my CL, compiling the VM, and running the program I see the following error message:
type '<Y0 extends int>(Y0) => void' is not a subtype of type '<Y0 extends int>(Y0) => void'
It seems that the type test should pass at run time. Just in case, here's how the result of compiling the program above into Kernel looks like:
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
class A<X extends core::num> extends core::Object {
synthetic constructor •() → self::A<self::A::X>
: super core::Object::•()
;
method f<generic-covariant-impl Y extends self::A::X>(self::A::f::Y y) → void {}
}
static method main() → dynamic {
self::A<core::num> a = new self::A::•<core::int>();
<Y extends core::int>(Y) → void f = (a as{ForNonNullableByDefault} self::A<core::int>).{self::A::f}{<Y extends core::int>(Y) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} <Y extends core::int>(Y) → void;
core::print(f.{core::Object::runtimeType}{core::Type});
}
Metadata
Metadata
Assignees
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.