OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Test that rti dependency registration takes type variables within typedefs | 5 // Test that rti dependency registration takes type variables within typedefs |
6 // into account. | 6 // into account. |
7 | 7 |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 | 9 |
10 typedef Foo<T>(T t); | 10 typedef Foo<T>(T t); |
11 | 11 |
12 class A<T> { | 12 class A<T> { |
13 m() => new B<Foo<T>>(); | 13 m() => new B<Foo<T>>(); |
14 } | 14 } |
15 | 15 |
16 class B<T> { | 16 class B<T> { |
17 m(o) => o is T; | 17 m(o) => o is T; |
18 } | 18 } |
19 | 19 |
20 foo(int i) {} | 20 foo(int i) {} |
21 bar(String s) {} | 21 bar(String s) {} |
22 | 22 |
23 void main() { | 23 void main() { |
24 Expect.isTrue(new A<int>().m().m(foo)); | 24 Expect.isTrue(new A<int>().m().m(foo)); |
25 Expect.isFalse(new A<int>().m().m(bar)); | 25 Expect.isFalse(new A<int>().m().m(bar)); |
26 Expect.isFalse(new A<String>().m().m(foo)); | 26 Expect.isFalse(new A<String>().m().m(foo)); |
27 Expect.isTrue(new A<String>().m().m(bar)); | 27 Expect.isTrue(new A<String>().m().m(bar)); |
28 Expect.isFalse(new A<double>().m().m(foo)); | 28 Expect.isFalse(new A<double>().m().m(foo)); |
29 Expect.isFalse(new A<double>().m().m(bar)); | 29 Expect.isFalse(new A<double>().m().m(bar)); |
30 } | 30 } |
OLD | NEW |