OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 Null is a subtype of any other type. | 5 // Test that Null is a subtype of any other type. |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 | 8 |
9 class A {} | 9 class A {} |
10 | |
11 typedef A ReturnA(); | 10 typedef A ReturnA(); |
12 typedef TakeA(A a); | 11 typedef TakeA(A a); |
13 typedef Null ReturnNull(); | 12 typedef Null ReturnNull(); |
14 typedef TakeNull(Null n); | 13 typedef TakeNull(Null n); |
15 | 14 |
16 @NoInline() | 15 @NoInline() |
17 testA(A a) {} | 16 testA(A a) {} |
18 | 17 |
19 @NoInline() | 18 @NoInline() |
20 testListA(List<A> list) {} | 19 testListA(List<A> list) {} |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 testAsTakeA(takeA); // //# 33: o
k | 132 testAsTakeA(takeA); // //# 33: o
k |
134 // This is not valid in strong-mode: (Null)-> <: (A)-> | 133 // This is not valid in strong-mode: (Null)-> <: (A)-> |
135 testAsTakeA(takeNull); // //# 34: o
k | 134 testAsTakeA(takeNull); // //# 34: o
k |
136 | 135 |
137 testTakeNull(takeA); // //# 35: o
k | 136 testTakeNull(takeA); // //# 35: o
k |
138 testTakeNull(takeNull); // //# 36: o
k | 137 testTakeNull(takeNull); // //# 36: o
k |
139 Expect.isTrue(testIsTakeNull(takeA)); // //# 37: o
k | 138 Expect.isTrue(testIsTakeNull(takeA)); // //# 37: o
k |
140 Expect.isTrue(testIsTakeNull(takeNull)); // //# 38: o
k | 139 Expect.isTrue(testIsTakeNull(takeNull)); // //# 38: o
k |
141 testAsTakeNull(takeA); // //# 39: o
k | 140 testAsTakeNull(takeA); // //# 39: o
k |
142 testAsTakeNull(takeNull); // //# 40: o
k | 141 testAsTakeNull(takeNull); // //# 40: o
k |
143 } | 142 } |
OLD | NEW |