Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: pkg/front_end/testcases/inference/downwards_inference_on_list_literals_infer_if_value_types_match_context.dart

Issue 2946273002: Implement override-based type inference for instance methods. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /*@topType=dynamic*/ method(
25 AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) {
25 /*@target=C::assertAOf*/ assertAOf( 26 /*@target=C::assertAOf*/ assertAOf(
26 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 27 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
27 assertBOf( 28 assertBOf(
28 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 29 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
29 assertCOf( 30 assertCOf(
30 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 31 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
31 /*@target=C::assertDOf*/ assertDOf( 32 /*@target=C::assertDOf*/ assertDOf(
32 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 33 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
33 assertEOf( 34 assertEOf(
34 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 35 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
35 } 36 }
36 } 37 }
37 38
38 abstract class G<T> { 39 abstract class G<T> {
39 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf; 40 AsserterBuilder<List<Asserter<DartType>>, DartType> assertAOf;
40 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf; 41 AsserterBuilder<List<Asserter<DartType>>, DartType> get assertDOf;
41 42
42 method(AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) { 43 /*@topType=dynamic*/ method(
44 AsserterBuilder<List<Asserter<DartType>>, DartType> assertEOf) {
43 /*@target=G::assertAOf*/ assertAOf( 45 /*@target=G::assertAOf*/ assertAOf(
44 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 46 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
45 this. /*@target=G::assertAOf*/ assertAOf( 47 this. /*@target=G::assertAOf*/ assertAOf(
46 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 48 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
47 this. /*@target=G::assertDOf*/ assertDOf( 49 this. /*@target=G::assertDOf*/ assertDOf(
48 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 50 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
49 assertEOf( 51 assertEOf(
50 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 52 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
51 } 53 }
52 } 54 }
(...skipping 21 matching lines...) Expand all
74 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 76 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
75 77
76 G<int> g; 78 G<int> g;
77 g. /*@target=G::assertAOf*/ assertAOf( 79 g. /*@target=G::assertAOf*/ assertAOf(
78 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 80 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
79 g. /*@target=G::assertDOf*/ assertDOf( 81 g. /*@target=G::assertDOf*/ assertDOf(
80 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]); 82 /*@typeArgs=(DartType) -> void*/ [_isInt, _isString]);
81 } 83 }
82 84
83 main() {} 85 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698