blob: 4e79ee118b71c161023b9cd87f8b32aac5bdbb1e [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/extension_types/issue54625_2.dart:9:1: Error: Type argument 'Null' doesn't conform to the bound 'Supertype' of the type variable 'Subtype' on 'A'.
// Try changing type arguments so that they conform to the bounds.
// A<X, Null> Function<X extends E>() // Error.
// ^
// pkg/front_end/testcases/extension_types/issue54625_2.dart:7:20: Context: This is the type variable whose bound isn't conformed to.
// class A<Supertype, Subtype extends Supertype> {}
// ^
//
// pkg/front_end/testcases/extension_types/issue54625_2.dart:21:7: Error: A value of type 'Null Function<Y extends E>()' can't be assigned to a variable of type 'X Function<X extends E>()' because 'Null' is nullable and 'X' isn't.
// f = returnsNull; // Error.
// ^
//
import self as self;
import "dart:core" as core;
class A<Supertype extends core::Object? = dynamic, Subtype extends self::A::Supertype% = dynamic> extends core::Object {
synthetic constructor •() self::A<self::A::Supertype%, self::A::Subtype%>
: super core::Object::•()
;
}
extension type E(core::num it) implements core::num {
abstract extension-type-member representation-field get it() core::num;
constructor = self::E|constructor#;
constructor tearoff = self::E|constructor#_#new#tearOff;
}
static method foo() <X extends self::E /* erasure=core::num */ = dynamic>() X
return throw 0;
static method test1() <X extends self::E /* erasure=core::num */ = dynamic>() self::A<X, Null>
return throw 0;
static method test2() <X extends self::E /* erasure=core::num */ = dynamic>() self::A<core::Object, X>
return throw 0;
static extension-type-member method E|constructor#(core::num it) → self::E /* erasure=core::num */ {
lowered final self::E /* erasure=core::num */ #this = it;
return #this;
}
static extension-type-member method E|constructor#_#new#tearOff(core::num it) → self::E /* erasure=core::num */
return self::E|constructor#(it);
static method returnsNull<Y extends self::E /* erasure=core::num */>() Null
return null;
static method test3() dynamic {
<X extends self::E /* erasure=core::num */ = dynamic>() X f = self::foo();
f = invalid-expression "pkg/front_end/testcases/extension_types/issue54625_2.dart:21:7: Error: A value of type 'Null Function<Y extends E>()' can't be assigned to a variable of type 'X Function<X extends E>()' because 'Null' is nullable and 'X' isn't.
f = returnsNull; // Error.
^" in #C1 as{TypeError} Never;
}
constants {
#C1 = static-tearoff self::returnsNull
}