blob: a441003f143c4262b0f2e37f7d160e41718b1b8b [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.7
// dart2jsOptions=--omit-implicit-checks
// Test type tests of function types used a type argument.
import 'package:expect/expect.dart';
class A<T> {}
main() {
class B1<T> {}
class C1 extends B1<int> {}
test1() {
Expect.isTrue(_test1(new A<void Function(C1)>()));
Expect.isTrue(_test1(new A<void Function(B1<int>)>())); //# 01: ok
Expect.isFalse(_test1(new A<void Function(B1<String>)>()));
_test1(f) => f is A<void Function(C1)>;
class B2<T> {}
class C2 extends B2<int> {}
test2() {
Expect.isTrue(_test2(new A<C2 Function()>()));
Expect.isFalse(_test2(new A<B2<int> Function()>()));
Expect.isFalse(_test2(new A<B2<String> Function()>()));
_test2(f) => f is A<C2 Function()>;
class B3<T> {}
class C3 extends B3<int> {}
test3() {
Expect.isFalse(_test3(new A<void Function(C3)>()));
Expect.isTrue(_test3(new A<void Function(B3<int>)>()));
Expect.isFalse(_test3(new A<void Function(B3<String>)>()));
_test3(f) => f is A<void Function(B3<int>)>;
class B4<T> {}
class C4 extends B4<int> {}
test4() {
Expect.isTrue(_test4(new A<C4 Function()>()));
Expect.isTrue(_test4(new A<B4<int> Function()>()));
Expect.isFalse(_test4(new A<B4<String> Function()>()));
_test4(f) => f is A<B4<int> Function()>;
class B5<T> {}
class C5 extends B5<int> {}
test5() {
Expect.isTrue(_test5(new A<void Function(C5 Function())>()));
Expect.isTrue(_test5(new A<void Function(B5<int> Function())>())); //# 02: ok
Expect.isFalse(_test5(new A<void Function(B5<String> Function())>()));
_test5(f) => f is A<void Function(C5 Function())>;
class B6<T> {}
class C6 extends B6<int> {}
test6() {
Expect.isTrue(_test6(new A<void Function(void Function(C6))>()));
Expect.isFalse(_test6(new A<void Function(void Function(B6<int>))>()));
Expect.isFalse(_test6(new A<void Function(void Function(B6<String>))>()));
_test6(f) => f is A<void Function(void Function(C6))>;