Skip to content

Commit 7486512

Browse files
committed
Update CFE expectations for extension method tests.
Change-Id: I673f5187d74cddfe2f2e54774a713713a137b081 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120025 Reviewed-by: Johnni Winther <johnniwinther@google.com>
1 parent 2ca8125 commit 7486512

7 files changed

+233
-282
lines changed

tests/language_2/extension_methods/static_extension_bounds_error_test.dart

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ void main() {
3535
s.e1;
3636
// ^^
3737
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
38-
// [cfe] unspecified
38+
// [cfe] The getter 'e1' isn't defined for the class 'String'.
3939
E1(s).e1;
4040
//^^
4141
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
42-
// [cfe] unspecified
42+
// ^
43+
// [cfe] Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'E1|get#e1'.
4344
E1<String>(s).e1;
4445
// ^^^^^^
4546
// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
46-
// [cfe] unspecified
47+
// ^
48+
// [cfe] Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'E1|get#e1'.
4749

4850
// Inferred types of int and double are ok
4951
i.e1;
@@ -57,15 +59,17 @@ void main() {
5759
s.e2;
5860
// ^^
5961
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
60-
// [cfe] unspecified
62+
// [cfe] The getter 'e2' isn't defined for the class 'String'.
6163
E2(s).e2;
6264
//^^
6365
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
64-
// [cfe] unspecified
66+
// ^
67+
// [cfe] Inferred type argument 'String' doesn't conform to the bound 'S' of the type variable 'T' on 'E2|get#e2'.
6568
E2<String, num>(s).e2;
6669
// ^^^^^^
6770
// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
68-
// [cfe] unspecified
71+
// ^
72+
// [cfe] Inferred type argument 'String' doesn't conform to the bound 'S' of the type variable 'T' on 'E2|get#e2'.
6973

7074
// Inferred types of int and double are ok
7175
i.e2;
@@ -80,15 +84,15 @@ void main() {
8084
s.f3(3);
8185
// ^^
8286
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
83-
// [cfe] unspecified
87+
// [cfe] Type argument 'int' doesn't conform to the bound 'T' of the type variable 'S' on 'E3|f3'.
8488
E3(s).f3(3);
8589
// ^^
8690
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
87-
// [cfe] unspecified
91+
// [cfe] Inferred type argument 'int' doesn't conform to the bound 'T' of the type variable 'S' on 'E3|f3'.
8892
E3<String>(s).f3(3);
8993
// ^^
9094
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
91-
// [cfe] unspecified
95+
// [cfe] Inferred type argument 'int' doesn't conform to the bound 'T' of the type variable 'S' on 'E3|f3'.
9296

9397
// Inferred type int for method type parameter is ok
9498
i.f3(3);
@@ -100,15 +104,15 @@ void main() {
100104
d.f3(3);
101105
// ^^
102106
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
103-
// [cfe] unspecified
107+
// [cfe] Type argument 'int' doesn't conform to the bound 'T' of the type variable 'S' on 'E3|f3'.
104108
E3(d).f3(3);
105109
// ^^
106110
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
107-
// [cfe] unspecified
111+
// [cfe] Inferred type argument 'int' doesn't conform to the bound 'T' of the type variable 'S' on 'E3|f3'.
108112
E3<double>(d).f3(3);
109113
// ^^
110114
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
111-
// [cfe] unspecified
115+
// [cfe] Inferred type argument 'int' doesn't conform to the bound 'T' of the type variable 'S' on 'E3|f3'.
112116

113117
RecSolution recs = RecSolution();
114118
Rec<dynamic> superRec = RecSolution(); // Super-bounded type.
@@ -122,13 +126,15 @@ void main() {
122126
superRec.e4;
123127
// ^^
124128
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
125-
// [cfe] unspecified
129+
// [cfe] The getter 'e4' isn't defined for the class 'Rec<dynamic>'.
126130
E4(superRec).e4;
127131
//^^
128132
// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
129-
// [cfe] unspecified
133+
// ^
134+
// [cfe] Inferred type argument 'Rec<dynamic>' doesn't conform to the bound 'Rec<T>' of the type variable 'T' on 'E4|get#e4'.
130135
E4<Rec<dynamic>>(superRec).e4;
131136
// ^^^^^^^^^^^^
132137
// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
133-
// [cfe] unspecified
138+
// ^
139+
// [cfe] Inferred type argument 'Rec<dynamic>' doesn't conform to the bound 'Rec<T>' of the type variable 'T' on 'E4|get#e4'.
134140
}

tests/language_2/extension_methods/static_extension_getter_setter_conflicts_test.dart

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,67 +26,73 @@ void test0() {
2626
c0.m1 = 0;
2727
// ^^
2828
// [analyzer] STATIC_WARNING.ASSIGNMENT_TO_FINAL_NO_SETTER
29-
// [cfe] unspecified
29+
// [cfe] The setter 'm1' isn't defined for the class 'C0'.
3030
E0(c0).m1 = 0;
3131
E0(c0).m1;
3232
// ^^
3333
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_EXTENSION_GETTER
34-
// [cfe] unspecified
34+
// [cfe] Getter not found: 'm1'.
3535

3636
c0.m1 += 0;
3737
// ^^
3838
// [analyzer] STATIC_WARNING.ASSIGNMENT_TO_FINAL_NO_SETTER
39-
// [cfe] unspecified
39+
// [cfe] The setter 'm1' isn't defined for the class 'C0'.
4040

4141
c0.m1++;
4242
// ^^
4343
// [analyzer] STATIC_WARNING.ASSIGNMENT_TO_FINAL_NO_SETTER
44-
// [cfe] unspecified
44+
// [cfe] The setter 'm1' isn't defined for the class 'C0'.
4545

4646
c0.m2 = 0;
4747
c0.m2;
4848
// ^^
4949
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
50-
// [cfe] unspecified
50+
// [cfe] The getter 'm2' isn't defined for the class 'C0'.
5151
c0.m2 += 0;
5252
// ^^
5353
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
54-
// [cfe] unspecified
54+
// [cfe] The getter 'm2' isn't defined for the class 'C0'.
5555
c0.m2++;
5656
// ^^
5757
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
58-
// [cfe] unspecified
58+
// [cfe] The getter 'm2' isn't defined for the class 'C0'.
5959

6060
E0(c0).m2;
6161

6262
c0[0];
6363
c0[0] = 0;
64+
//^
65+
// [cfe] The method '[]=' isn't defined for the class 'C0'.
6466
// ^^^^^^
6567
// [analyzer] unspecified
66-
// [cfe] unspecified
6768
E0(c0)[0];
6869
// ^^^^^^
6970
// [analyzer] unspecified
70-
// [cfe] unspecified
71+
// ^
72+
// [cfe] Getter not found: '[]'.
7173
E0(c0)[0] = 0;
7274

7375
c0[0] += 0;
76+
//^
77+
// [cfe] The method '[]=' isn't defined for the class 'C0'.
7478
// ^^^^^^
7579
// [analyzer] unspecified
76-
// [cfe] unspecified
7780
c0[0]++;
81+
//^
82+
// [cfe] The method '[]=' isn't defined for the class 'C0'.
7883
// ^^^^^^
7984
// [analyzer] unspecified
80-
// [cfe] unspecified
8185

8286
E0(c0)[0] += 0;
8387
// ^^^^^^
8488
// [analyzer] unspecified
85-
// [cfe] unspecified
89+
// ^
90+
// [cfe] The method '[]' isn't defined for the class 'dynamic'.
8691
E0(c0)[0]++;
8792
// ^^^^^^
8893
// [analyzer] unspecified
89-
// [cfe] unspecified
94+
// ^
95+
// [cfe] The method '[]' isn't defined for the class 'dynamic'.
9096
}
9197

9298
// Conflicting extensions.
@@ -112,29 +118,32 @@ void test1() {
112118
c1a.m1 = 0;
113119
// ^^
114120
// [analyzer] STATIC_WARNING.ASSIGNMENT_TO_FINAL_LOCAL
115-
// [cfe] unspecified
121+
// [cfe] The setter 'm1' isn't defined for the class 'C1<int>'.
116122

117123
c1a.m2;
118124
// ^^
119125
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
120-
// [cfe] unspecified
126+
// [cfe] The getter 'm2' isn't defined for the class 'C1<int>'.
121127

122128
c1a.m2 = 0;
123129

124130
c1a[0] = 0;
131+
// ^
132+
// [cfe] The method '[]=' isn't defined for the class 'C1<int>'.
125133
// ^^
126134
// [analyzer] unspecified
127-
// [cfe] unspecified
128135

129136
c1a[0] += 0;
137+
// ^
138+
// [cfe] The method '[]=' isn't defined for the class 'C1<int>'.
130139
// ^^
131140
// [analyzer] unspecified
132-
// [cfe] unspecified
133141

134142
c1a[0]++;
143+
// ^
144+
// [cfe] The method '[]=' isn't defined for the class 'C1<int>'.
135145
// ^^
136146
// [analyzer] unspecified
137-
// [cfe] unspecified
138147

139148
c1a[0];
140149

@@ -143,59 +152,59 @@ void test1() {
143152
c1b.m1;
144153
// ^^
145154
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS
146-
// [cfe] unspecified
155+
// [cfe] The getter 'm1' isn't defined for the class 'C1<Object>'.
147156

148157
c1b.m1 = 0;
149158
// ^^
150159
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS
151-
// [cfe] unspecified
160+
// [cfe] The setter 'm1' isn't defined for the class 'C1<Object>'.
152161

153162
c1b.m1 += 0;
154163
// ^^
155164
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS
156-
// ^^
157-
// [cfe] unspecified
158-
// ^^
159-
// [cfe] unspecified
165+
// [cfe] The getter 'm1' isn't defined for the class 'C1<Object>'.
166+
// ^
167+
// [cfe] The setter 'm1' isn't defined for the class 'C1<Object>'.
160168

161169
c1b.m1++;
162170
// ^^
163171
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS
164-
// ^^
165-
// [cfe] unspecified
166-
// ^^
167-
// [cfe] unspecified
172+
// [cfe] The getter 'm1' isn't defined for the class 'C1<Object>'.
173+
// ^
174+
// [cfe] The setter 'm1' isn't defined for the class 'C1<Object>'.
168175

169176
c1b.m2;
170177
// ^^
171178
// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS
172-
// [cfe] unspecified
179+
// [cfe] The getter 'm2' isn't defined for the class 'C1<Object>'.
173180

174181
c1b[0];
182+
// ^
183+
// [cfe] The method '[]' isn't defined for the class 'C1<Object>'.
175184
// ^^
176185
// [analyzer] unspecified
177-
// [cfe] unspecified
178186

179187
c1b[0] = 0;
188+
// ^
189+
// [cfe] The method '[]=' isn't defined for the class 'C1<Object>'.
180190
// ^^
181191
// [analyzer] unspecified
182-
// [cfe] unspecified
183192

184193
c1b[0] += 0;
185-
// ^^
186-
// [analyzer] unspecified
187194
// ^
188-
// [cfe] unspecified
195+
// [cfe] The method '[]' isn't defined for the class 'C1<Object>'.
189196
// ^
190-
// [cfe] unspecified
191-
192-
c1b[0]++;
197+
// [cfe] The method '[]=' isn't defined for the class 'C1<Object>'.
193198
// ^^
194199
// [analyzer] unspecified
200+
201+
c1b[0]++;
195202
// ^
196-
// [cfe] unspecified
203+
// [cfe] The method '[]' isn't defined for the class 'C1<Object>'.
197204
// ^
198-
// [cfe] unspecified
205+
// [cfe] The method '[]=' isn't defined for the class 'C1<Object>'.
206+
// ^^
207+
// [analyzer] unspecified
199208
}
200209

201210
// Getter on the extension itself.
@@ -220,29 +229,32 @@ extension E2 on C2 {
220229
this.m1 = 0;
221230
// ^^
222231
// [analyzer] STATIC_WARNING.ASSIGNMENT_TO_FINAL_NO_SETTER
223-
// [cfe] unspecified
232+
// [cfe] The setter 'm1' isn't defined for the class 'C2'.
224233

225234
this.m2 = 0;
226235
this.m2;
227236
// ^^
228237
// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
229-
// [cfe] unspecified
238+
// [cfe] The getter 'm2' isn't defined for the class 'C2'.
230239

231240
this[0] = 0;
232241
this[0];
242+
// ^
243+
// [cfe] The method '[]' isn't defined for the class 'C2'.
233244
// ^^
234245
// [analyzer] unspecified
235-
// [cfe] unspecified
236246

237247
this[0] += 0;
248+
// ^
249+
// [cfe] The method '[]' isn't defined for the class 'C2'.
238250
// ^^
239251
// [analyzer] unspecified
240-
// [cfe] unspecified
241252

242253
this[0] ++;
254+
// ^
255+
// [cfe] The method '[]' isn't defined for the class 'C2'.
243256
// ^^
244257
// [analyzer] unspecified
245-
// [cfe] unspecified
246258

247259
// Check that `this.mc` refers to `C2.mc`.
248260
this.mc.toRadixString(16);

0 commit comments

Comments
 (0)