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 // Dart test program for constructors and initializers. | 4 // Dart test program for constructors and initializers. |
5 | 5 |
6 // Check function subtyping. | 6 // Check function subtyping. |
7 | 7 |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 | 9 |
10 typedef t__(); | 10 typedef t__(); |
(...skipping 18 matching lines...) Expand all Loading... |
29 void void_2() {} | 29 void void_2() {} |
30 int int_() => 0; | 30 int int_() => 0; |
31 int int_2() => 0; | 31 int int_2() => 0; |
32 Object Object_() => null; | 32 Object Object_() => null; |
33 double double_() => 0.0; | 33 double double_() => 0.0; |
34 void void__int(int i) {} | 34 void void__int(int i) {} |
35 int int__int(int i) => 0; | 35 int int__int(int i) => 0; |
36 int int__int2(int i) => 0; | 36 int int__int2(int i) => 0; |
37 int int__Object(Object o) => 0; | 37 int int__Object(Object o) => 0; |
38 Object Object__int(int i) => null; | 38 Object Object__int(int i) => null; |
| 39 void void__Object(Object o) => null; |
39 int int__double(double d) => 0; | 40 int int__double(double d) => 0; |
40 int int__int_int(int i1, int i2) => 0; | 41 int int__int_int(int i1, int i2) => 0; |
41 void inline_void_(void f()) {} | 42 void inline_void_(void f()) {} |
42 void inline_void__int(void f(int i)) {} | 43 void inline_void__int(void f(int i)) {} |
43 | 44 |
44 main() { | 45 main() { |
45 // () -> int <: Function | 46 // () -> int <: Function |
46 Expect.isTrue(int_ is Function); | 47 Expect.isTrue(int_ is Function); |
47 // () -> dynamic <: () -> dynamic | 48 // () -> dynamic <: () -> dynamic |
48 Expect.isTrue(_ is t__); | 49 Expect.isTrue(_ is t__); |
(...skipping 26 matching lines...) Expand all Loading... |
75 // (int) -> int <: (double) -> int | 76 // (int) -> int <: (double) -> int |
76 Expect.isFalse(int__int is t_int__double); | 77 Expect.isFalse(int__int is t_int__double); |
77 // () -> int <: (int) -> int | 78 // () -> int <: (int) -> int |
78 Expect.isFalse(int_ is t_int__int); | 79 Expect.isFalse(int_ is t_int__int); |
79 // (int) -> int <: (int,int) -> int | 80 // (int) -> int <: (int,int) -> int |
80 Expect.isFalse(int__int is t_int__int_int); | 81 Expect.isFalse(int__int is t_int__int_int); |
81 // (int,int) -> int <: (int) -> int | 82 // (int,int) -> int <: (int) -> int |
82 Expect.isFalse(int__int_int is t_int__int); | 83 Expect.isFalse(int__int_int is t_int__int); |
83 // (()->void) -> void <: ((int)->void) -> void | 84 // (()->void) -> void <: ((int)->void) -> void |
84 Expect.isFalse(inline_void_ is t_inline_void__int); | 85 Expect.isFalse(inline_void_ is t_inline_void__int); |
| 86 // (Object) -> void <: ((int)->void) -> void |
| 87 Expect.isTrue(void__Object is t_inline_void__int); |
85 // ((int)->void) -> void <: (()->void) -> void | 88 // ((int)->void) -> void <: (()->void) -> void |
86 Expect.isFalse(inline_void__int is t_inline_void_); | 89 Expect.isFalse(inline_void__int is t_inline_void_); |
87 } | 90 } |
OLD | NEW |