[cfe] Add inheritance tests for reported problems
Change-Id: I2dfc46f718e7609f3626040eb3542b5441574975 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135907 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
514a754150
commit
a350984b65
@@ -0,0 +1,29 @@
|
||||
/*library: nnbd=true*/
|
||||
/*class: A:A<T>,Object*/
|
||||
class A<T> {
|
||||
/*member: A.test:void Function()!*/
|
||||
void test() {
|
||||
print(T);
|
||||
}
|
||||
}
|
||||
|
||||
/*class: B:A<Object?>,B,Object*/
|
||||
/*member: B.test:void Function()!*/
|
||||
class B extends A<Object?> {}
|
||||
|
||||
/*class: C:A<dynamic>,C,Object*/
|
||||
/*member: C.test:void Function()!*/
|
||||
class C extends A<dynamic> {}
|
||||
|
||||
/*class: D1:A<Object?>,B,C,D1,Object*/
|
||||
/*member: D1.test:void Function()!*/
|
||||
class D1 extends B implements C {}
|
||||
|
||||
/*class: D2:A<Object?>,B,C,D2,Object*/
|
||||
/*member: D2.test:void Function()!*/
|
||||
class D2 extends C implements B {}
|
||||
|
||||
void main() {
|
||||
D1().test();
|
||||
D2().test();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*library: nnbd=true*/
|
||||
import "opt_out.dart";
|
||||
import "dart:async";
|
||||
|
||||
Type typeOf<X>() => X;
|
||||
|
||||
/*class: C:A<FutureOr<int?>!>,C,Object*/
|
||||
class C extends A<FutureOr<int?>> {
|
||||
/*member: C.getType:Type* Function()**/
|
||||
}
|
||||
|
||||
/*class: D:A<FutureOr<int!>!>,D,Object*/
|
||||
class D extends A<FutureOr<int>> {
|
||||
/*member: D.getType:Type* Function()**/
|
||||
}
|
||||
|
||||
/*class: E:A<FutureOr<int?>?>,B,C,E,Object*/
|
||||
class E extends B implements C {
|
||||
/*member: E.getType:Type* Function()**/
|
||||
}
|
||||
|
||||
main() {
|
||||
print(typeOf<FutureOr<int?>>() == E().getType());
|
||||
print(typeOf<FutureOr<int>>() == E().getType());
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// @dart=2.6
|
||||
|
||||
/*library: nnbd=false*/
|
||||
import "dart:async";
|
||||
|
||||
/*class: A:A<T*>,Object*/
|
||||
class A<T> {
|
||||
/*member: A.getType:Type* Function()**/
|
||||
Type getType() => T;
|
||||
}
|
||||
|
||||
/*class: B:A<FutureOr<int*>*>,B,Object*/
|
||||
class B extends A<FutureOr<int>> {
|
||||
/*member: B.getType:Type* Function()**/
|
||||
}
|
||||
Reference in New Issue
Block a user