OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /*@testedFeatures=inference*/ | 5 /*@testedFeatures=inference*/ |
6 library test; | 6 library test; |
7 | 7 |
8 class DartType {} | 8 class DartType {} |
9 | 9 |
10 typedef void Asserter<T>(T type); | 10 typedef void Asserter<T>(T type); |
11 typedef Asserter<T> AsserterBuilder<S, T>(S arg); | 11 typedef Asserter<T> AsserterBuilder<S, T>(S arg); |
12 | 12 |
13 Asserter<DartType> _isInt; | 13 Asserter<DartType> _isInt; |
14 Asserter<DartType> _isString; | 14 Asserter<DartType> _isString; |
15 | 15 |
16 abstract class C { | 16 abstract class C { |
17 static AsserterBuilder<List<Asserter<DartType>>, DartType> assertBOf; | 17 static AsserterBuilder<List<Asserter<DartType>>, DartType> assertBOf; |
18 static AsserterBuilder<List<Asserter<DartType>>, DartType> get assertCOf => | 18 static AsserterBuilder<List<Asserter<DartType>>, DartType> get assertCOf => |
19 null; | 19 null; |
20 | 20 |
21 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; | 21 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; |
22 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf; | 22 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf; |
23 | 23 |
24 method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) { | 24 method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) { |
25 assertAOf( | 25 /*@target=C::assertAOf*/ assertAOf( |
26 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 26 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
27 assertBOf( | 27 assertBOf( |
28 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 28 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
29 assertCOf( | 29 assertCOf( |
30 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 30 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
31 assertDOf( | 31 /*@target=C::assertDOf*/ assertDOf( |
32 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 32 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
33 assertEOf( | 33 assertEOf( |
34 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 34 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 abstract class G<T> { | 38 abstract class G<T> { |
39 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; | 39 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; |
40 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf; | 40 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf; |
41 | 41 |
42 method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) { | 42 method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) { |
43 assertAOf( | 43 /*@target=G::assertAOf*/ assertAOf( |
44 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 44 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
45 this. /*@target=G::assertAOf*/ assertAOf( | 45 this. /*@target=G::assertAOf*/ assertAOf( |
46 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 46 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
47 this. /*@target=G::assertDOf*/ assertDOf( | 47 this. /*@target=G::assertDOf*/ assertDOf( |
48 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 48 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
49 assertEOf( | 49 assertEOf( |
50 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 50 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 AsserterBuilder<List<Asserter<DartType>>, DartType> assertBOf; | 54 AsserterBuilder<List<Asserter<DartType>>, DartType> assertBOf; |
55 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertCOf => null; | 55 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertCOf => null; |
56 | 56 |
57 main() { | 57 test() { |
58 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; | 58 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; |
59 assertAOf( | 59 assertAOf( |
60 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 60 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
61 assertBOf( | 61 assertBOf( |
62 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 62 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
63 assertCOf( | 63 assertCOf( |
64 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 64 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
65 C. /*@target=C::assertBOf*/ assertBOf( | 65 C.assertBOf( |
66 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 66 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
67 C. /*@target=C::assertCOf*/ assertCOf( | 67 C.assertCOf( |
68 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 68 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
69 | 69 |
70 C c; | 70 C c; |
71 c. /*@target=C::assertAOf*/ assertAOf( | 71 c. /*@target=C::assertAOf*/ assertAOf( |
72 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 72 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
73 c. /*@target=C::assertDOf*/ assertDOf( | 73 c. /*@target=C::assertDOf*/ assertDOf( |
74 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 74 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
75 | 75 |
76 G<int> g; | 76 G<int> g; |
77 g. /*@target=G::assertAOf*/ assertAOf( | 77 g. /*@target=G::assertAOf*/ assertAOf( |
78 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 78 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
79 g. /*@target=G::assertDOf*/ assertDOf( | 79 g. /*@target=G::assertDOf*/ assertDOf( |
80 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); | 80 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); |
81 } | 81 } |
| 82 |
| 83 main() {} |
OLD | NEW |