OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // Dart test program for constructors and initializers. |
| 5 |
| 6 // Check function subtyping with type variables in factory constructors. |
| 7 |
| 8 import 'package:expect/expect.dart'; |
| 9 |
| 10 typedef void Foo(); |
| 11 |
| 12 class A<T> { |
| 13 bool foo(a) => a is T; |
| 14 } |
| 15 |
| 16 void bar1() {} |
| 17 void bar2(i) {} |
| 18 |
| 19 void main() { |
| 20 void bar3() {} |
| 21 void bar4(i) {} |
| 22 |
| 23 Expect.isTrue(new A<Foo>().foo(bar1)); |
| 24 Expect.isFalse(new A<Foo>().foo(bar2)); |
| 25 Expect.isTrue(new A<Foo>().foo(bar3)); |
| 26 Expect.isFalse(new A<Foo>().foo(bar4)); |
| 27 Expect.isTrue(new A<Foo>().foo((){})); |
| 28 Expect.isFalse(new A<Foo>().foo((i){})); |
| 29 } |
OLD | NEW |