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 typedef A ReturnA(); | 10 typedef A ReturnA(); |
(...skipping 18 matching lines...) Expand all Loading... |
29 main() { | 29 main() { |
30 if (false) test(); // Perform static checks only. | 30 if (false) test(); // Perform static checks only. |
31 } | 31 } |
32 | 32 |
33 test() { | 33 test() { |
34 Null n; | 34 Null n; |
35 List<Null> listNull; | 35 List<Null> listNull; |
36 A a = new A(); | 36 A a = new A(); |
37 List<A> listA; | 37 List<A> listA; |
38 | 38 |
39 testA(n); /// 01: ok | 39 testA(n); //# 01: ok |
40 testA(a); /// 02: ok | 40 testA(a); //# 02: ok |
41 testListA(listNull); /// 03: ok | 41 testListA(listNull); //# 03: ok |
42 testListA(listA); /// 04: ok | 42 testListA(listA); //# 04: ok |
43 | 43 |
44 testNull(n); /// 05: ok | 44 testNull(n); //# 05: ok |
45 testNull(a); /// 06: ok | 45 testNull(a); //# 06: ok |
46 testListNull(listNull); /// 07: ok | 46 testListNull(listNull); //# 07: ok |
47 testListNull(listA); /// 08: ok | 47 testListNull(listA); //# 08: ok |
48 | 48 |
49 testReturnA(returnA); /// 09: ok | 49 testReturnA(returnA); //# 09: ok |
50 testReturnA(returnNull); /// 10: ok | 50 testReturnA(returnNull); //# 10: ok |
51 | 51 |
52 testReturnNull(returnA); /// 11: ok | 52 testReturnNull(returnA); //# 11: ok |
53 testReturnNull(returnNull); /// 12: ok | 53 testReturnNull(returnNull); //# 12: ok |
54 | 54 |
55 testTakeA(takeA); /// 13: ok | 55 testTakeA(takeA); //# 13: ok |
56 testTakeA(takeNull); /// 14: ok | 56 testTakeA(takeNull); //# 14: ok |
57 | 57 |
58 testTakeNull(takeA); /// 15: ok | 58 testTakeNull(takeA); //# 15: ok |
59 testTakeNull(takeNull); /// 16: ok | 59 testTakeNull(takeNull); //# 16: ok |
60 } | 60 } |
OLD | NEW |