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 // VMOptions=--enable_type_checks | 4 // VMOptions=--enable_type_checks |
5 // | 5 // |
6 // Dart test for function type alias with optional parameters. | 6 // Dart test for function type alias with optional parameters. |
7 | 7 |
8 import "package:expect/expect.dart"; | |
9 | |
10 typedef int f1<T>([int a, int b, T c]); | 8 typedef int f1<T>([int a, int b, T c]); |
11 typedef int f2<T>([int a, int b, T d]); | 9 typedef int f2<T>([int a, int b, T d]); |
12 typedef int f3<T>({int a, int b, T c}); | 10 typedef int f3<T>({int a, int b, T c}); |
13 typedef int f4<T>({int a, int b, T d}); | 11 typedef int f4<T>({int a, int b, T d}); |
14 | 12 |
15 class A<T> { | 13 class A<T> { |
16 int baz([int a, int b, T c]) { } | 14 int baz([int a, int b, T c]) { } |
17 int bar({int a, int b, T c}) { } | 15 int bar({int a, int b, T c}) { } |
18 } | 16 } |
19 | 17 |
(...skipping 24 matching lines...) Expand all Loading... |
44 Expect.isTrue(a.baz is f1); | 42 Expect.isTrue(a.baz is f1); |
45 Expect.isTrue(a.baz is f1<int>); | 43 Expect.isTrue(a.baz is f1<int>); |
46 Expect.isTrue(a.bar is f3<int>); | 44 Expect.isTrue(a.bar is f3<int>); |
47 Expect.isFalse(a.baz is f1<double>); | 45 Expect.isFalse(a.baz is f1<double>); |
48 Expect.isFalse(a.bar is f3<double>); | 46 Expect.isFalse(a.bar is f3<double>); |
49 Expect.isTrue(a.baz is f2); | 47 Expect.isTrue(a.baz is f2); |
50 Expect.isFalse(a.bar is f4); | 48 Expect.isFalse(a.bar is f4); |
51 Expect.isTrue(a.baz is f2<int>); | 49 Expect.isTrue(a.baz is f2<int>); |
52 Expect.isFalse(a.bar is f2<int>); | 50 Expect.isFalse(a.bar is f2<int>); |
53 } | 51 } |
OLD | NEW |