OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test for function type alias with a type parameter as result type. | 5 // Dart test for function type alias with a type parameter as result type. |
6 | 6 |
7 import "package:expect/expect.dart"; | |
8 | |
9 typedef bool F<bool>(bool a); // 'bool' is not the boolean type. | 7 typedef bool F<bool>(bool a); // 'bool' is not the boolean type. |
10 | 8 |
11 bool bar(bool a) { | 9 bool bar(bool a) { |
12 } | 10 } |
13 | 11 |
14 int baz(int a) { | 12 int baz(int a) { |
15 } | 13 } |
16 | 14 |
17 class A<T> { | 15 class A<T> { |
18 T foo(T a) { | 16 T foo(T a) { |
(...skipping 10 matching lines...) Expand all Loading... |
29 | 27 |
30 var b = new A<bool>(); | 28 var b = new A<bool>(); |
31 var i = new A<int>(); | 29 var i = new A<int>(); |
32 Expect.isTrue(b.foo is F); | 30 Expect.isTrue(b.foo is F); |
33 Expect.isTrue(i.foo is F); | 31 Expect.isTrue(i.foo is F); |
34 Expect.isTrue(b.foo is F<bool>); | 32 Expect.isTrue(b.foo is F<bool>); |
35 Expect.isTrue(i.foo is F<int>); | 33 Expect.isTrue(i.foo is F<int>); |
36 Expect.isTrue(b.foo is !F<int>); | 34 Expect.isTrue(b.foo is !F<int>); |
37 Expect.isTrue(i.foo is !F<bool>); | 35 Expect.isTrue(i.foo is !F<bool>); |
38 } | 36 } |
OLD | NEW |