Skip to content

Commit 6590bb4

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Migrate. Update ResolutionTest.assertElement()
Change-Id: I12ff0bf76ad67db8c251f190a32cfcae973dfbee Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406343 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Phil Quitslund <[email protected]>
1 parent 6bec51e commit 6590bb4

File tree

7 files changed

+94
-222
lines changed

7 files changed

+94
-222
lines changed

pkg/analyzer/test/src/dart/element/class_element_test.dart

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class B extends A {
160160
}
161161
''');
162162
var B = findElement2.class_('B');
163-
assertElement3(
163+
assertElement(
164164
B._lookUpInheritedConcreteGetter('foo'),
165165
declaration: findElement2.getter('foo', of: 'A'),
166166
);
@@ -199,7 +199,7 @@ class B extends A {
199199
}
200200
''');
201201
var B = findElement2.class_('B');
202-
assertElement3(
202+
assertElement(
203203
B._lookUpInheritedConcreteGetter('_foo'),
204204
declaration: findElement2.getter('_foo', of: 'A'),
205205
);
@@ -230,7 +230,7 @@ class A {
230230
class B extends A {}
231231
''');
232232
var B = findElement2.class_('B');
233-
assertElement3(
233+
assertElement(
234234
B._lookUpInheritedConcreteGetter('foo'),
235235
declaration: findElement2.getter('foo', of: 'A'),
236236
);
@@ -263,7 +263,7 @@ mixin M {
263263
class B extends A with M {}
264264
''');
265265
var B = findElement2.class_('B');
266-
assertElement3(
266+
assertElement(
267267
B._lookUpInheritedConcreteGetter('foo'),
268268
declaration: findElement2.getter('foo', of: 'M'),
269269
);
@@ -286,7 +286,7 @@ mixin M2 {
286286
class B extends A with M1, M2 {}
287287
''');
288288
var B = findElement2.class_('B');
289-
assertElement3(
289+
assertElement(
290290
B._lookUpInheritedConcreteGetter('foo'),
291291
declaration: findElement2.getter('foo', of: 'M2'),
292292
);
@@ -307,7 +307,7 @@ mixin M2 {}
307307
class B extends A with M1, M2 {}
308308
''');
309309
var B = findElement2.class_('B');
310-
assertElement3(
310+
assertElement(
311311
B._lookUpInheritedConcreteGetter('foo'),
312312
declaration: findElement2.getter('foo', of: 'M1'),
313313
);
@@ -324,7 +324,7 @@ mixin M {}
324324
class B extends A with M {}
325325
''');
326326
var B = findElement2.class_('B');
327-
assertElement3(
327+
assertElement(
328328
B._lookUpInheritedConcreteGetter('foo'),
329329
declaration: findElement2.getter('foo', of: 'A'),
330330
);
@@ -345,7 +345,7 @@ mixin M2 {
345345
class B extends A with M1, M2 {}
346346
''');
347347
var B = findElement2.class_('B');
348-
assertElement3(
348+
assertElement(
349349
B._lookUpInheritedConcreteGetter('foo'),
350350
declaration: findElement2.getter('foo', of: 'M1'),
351351
);
@@ -364,7 +364,7 @@ mixin M {
364364
class B extends A with M {}
365365
''');
366366
var B = findElement2.class_('B');
367-
assertElement3(
367+
assertElement(
368368
B._lookUpInheritedConcreteGetter('foo'),
369369
declaration: findElement2.getter('foo', of: 'A'),
370370
);
@@ -397,7 +397,7 @@ class B {
397397
class C extends A implements B {}
398398
''');
399399
var C = findElement2.class_('C');
400-
assertElement3(
400+
assertElement(
401401
C._lookUpInheritedConcreteGetter('foo'),
402402
declaration: findElement2.getter('foo', of: 'A'),
403403
);
@@ -464,7 +464,7 @@ class B extends A {
464464
}
465465
''');
466466
var B = findElement2.class_('B');
467-
assertElement3(
467+
assertElement(
468468
B._lookUpInheritedConcreteMethod('foo'),
469469
declaration: findElement2.method('foo', of: 'A'),
470470
);
@@ -503,7 +503,7 @@ class B extends A {
503503
}
504504
''');
505505
var B = findElement2.class_('B');
506-
assertElement3(
506+
assertElement(
507507
B._lookUpInheritedConcreteMethod('_foo'),
508508
declaration: findElement2.method('_foo', of: 'A'),
509509
);
@@ -534,7 +534,7 @@ class A {
534534
class B extends A {}
535535
''');
536536
var B = findElement2.class_('B');
537-
assertElement3(
537+
assertElement(
538538
B._lookUpInheritedConcreteMethod('foo'),
539539
declaration: findElement2.method('foo', of: 'A'),
540540
);
@@ -567,7 +567,7 @@ mixin M {
567567
class B extends A with M {}
568568
''');
569569
var B = findElement2.class_('B');
570-
assertElement3(
570+
assertElement(
571571
B._lookUpInheritedConcreteMethod('foo'),
572572
declaration: findElement2.method('foo', of: 'M'),
573573
);
@@ -590,7 +590,7 @@ mixin M2 {
590590
class B extends A with M1, M2 {}
591591
''');
592592
var B = findElement2.class_('B');
593-
assertElement3(
593+
assertElement(
594594
B._lookUpInheritedConcreteMethod('foo'),
595595
declaration: findElement2.method('foo', of: 'M2'),
596596
);
@@ -611,7 +611,7 @@ mixin M2 {}
611611
class B extends A with M1, M2 {}
612612
''');
613613
var B = findElement2.class_('B');
614-
assertElement3(
614+
assertElement(
615615
B._lookUpInheritedConcreteMethod('foo'),
616616
declaration: findElement2.method('foo', of: 'M1'),
617617
);
@@ -628,7 +628,7 @@ mixin M {}
628628
class B extends A with M {}
629629
''');
630630
var B = findElement2.class_('B');
631-
assertElement3(
631+
assertElement(
632632
B._lookUpInheritedConcreteMethod('foo'),
633633
declaration: findElement2.method('foo', of: 'A'),
634634
);
@@ -649,7 +649,7 @@ mixin M2 {
649649
class B extends A with M1, M2 {}
650650
''');
651651
var B = findElement2.class_('B');
652-
assertElement3(
652+
assertElement(
653653
B._lookUpInheritedConcreteMethod('foo'),
654654
declaration: findElement2.method('foo', of: 'M1'),
655655
);
@@ -668,7 +668,7 @@ mixin M {
668668
class B extends A with M {}
669669
''');
670670
var B = findElement2.class_('B');
671-
assertElement3(
671+
assertElement(
672672
B._lookUpInheritedConcreteMethod('foo'),
673673
declaration: findElement2.method('foo', of: 'A'),
674674
);
@@ -701,7 +701,7 @@ class B {
701701
class C extends A implements B {}
702702
''');
703703
var C = findElement2.class_('C');
704-
assertElement3(
704+
assertElement(
705705
C._lookUpInheritedConcreteMethod('foo'),
706706
declaration: findElement2.method('foo', of: 'A'),
707707
);
@@ -768,7 +768,7 @@ class B extends A {
768768
}
769769
''');
770770
var B = findElement2.class_('B');
771-
assertElement3(
771+
assertElement(
772772
B._lookUpInheritedConcreteSetter('foo'),
773773
declaration: findElement2.setter('foo', of: 'A'),
774774
);
@@ -807,7 +807,7 @@ class B extends A {
807807
}
808808
''');
809809
var B = findElement2.class_('B');
810-
assertElement3(
810+
assertElement(
811811
B._lookUpInheritedConcreteSetter('_foo'),
812812
declaration: findElement2.setter('_foo', of: 'A'),
813813
);
@@ -838,7 +838,7 @@ class A {
838838
class B extends A {}
839839
''');
840840
var B = findElement2.class_('B');
841-
assertElement3(
841+
assertElement(
842842
B._lookUpInheritedConcreteSetter('foo'),
843843
declaration: findElement2.setter('foo', of: 'A'),
844844
);
@@ -871,7 +871,7 @@ mixin M {
871871
class B extends A with M {}
872872
''');
873873
var B = findElement2.class_('B');
874-
assertElement3(
874+
assertElement(
875875
B._lookUpInheritedConcreteSetter('foo'),
876876
declaration: findElement2.setter('foo', of: 'M'),
877877
);
@@ -894,7 +894,7 @@ mixin M2 {
894894
class B extends A with M1, M2 {}
895895
''');
896896
var B = findElement2.class_('B');
897-
assertElement3(
897+
assertElement(
898898
B._lookUpInheritedConcreteSetter('foo'),
899899
declaration: findElement2.setter('foo', of: 'M2'),
900900
);
@@ -915,7 +915,7 @@ mixin M2 {}
915915
class B extends A with M1, M2 {}
916916
''');
917917
var B = findElement2.class_('B');
918-
assertElement3(
918+
assertElement(
919919
B._lookUpInheritedConcreteSetter('foo'),
920920
declaration: findElement2.setter('foo', of: 'M1'),
921921
);
@@ -932,7 +932,7 @@ mixin M {}
932932
class B extends A with M {}
933933
''');
934934
var B = findElement2.class_('B');
935-
assertElement3(
935+
assertElement(
936936
B._lookUpInheritedConcreteSetter('foo'),
937937
declaration: findElement2.setter('foo', of: 'A'),
938938
);
@@ -953,7 +953,7 @@ mixin M2 {
953953
class B extends A with M1, M2 {}
954954
''');
955955
var B = findElement2.class_('B');
956-
assertElement3(
956+
assertElement(
957957
B._lookUpInheritedConcreteSetter('foo'),
958958
declaration: findElement2.setter('foo', of: 'M1'),
959959
);
@@ -972,7 +972,7 @@ mixin M {
972972
class B extends A with M {}
973973
''');
974974
var B = findElement2.class_('B');
975-
assertElement3(
975+
assertElement(
976976
B._lookUpInheritedConcreteSetter('foo'),
977977
declaration: findElement2.setter('foo', of: 'A'),
978978
);
@@ -1005,7 +1005,7 @@ class B {
10051005
class C extends A implements B {}
10061006
''');
10071007
var C = findElement2.class_('C');
1008-
assertElement3(
1008+
assertElement(
10091009
C._lookUpInheritedConcreteSetter('foo'),
10101010
declaration: findElement2.setter('foo', of: 'A'),
10111011
);
@@ -1072,7 +1072,7 @@ class B extends A {
10721072
}
10731073
''');
10741074
var B = findElement2.class_('B');
1075-
assertElement3(
1075+
assertElement(
10761076
B._lookUpInheritedMethod('foo'),
10771077
declaration: findElement2.method('foo', of: 'A'),
10781078
);
@@ -1111,7 +1111,7 @@ class B extends A {
11111111
}
11121112
''');
11131113
var B = findElement2.class_('B');
1114-
assertElement3(
1114+
assertElement(
11151115
B._lookUpInheritedMethod('_foo'),
11161116
declaration: findElement2.method('_foo', of: 'A'),
11171117
);
@@ -1142,7 +1142,7 @@ class A {
11421142
class B extends A {}
11431143
''');
11441144
var B = findElement2.class_('B');
1145-
assertElement3(
1145+
assertElement(
11461146
B._lookUpInheritedMethod('foo'),
11471147
declaration: findElement2.method('foo', of: 'A'),
11481148
);
@@ -1161,7 +1161,7 @@ mixin M {
11611161
class B extends A with M {}
11621162
''');
11631163
var B = findElement2.class_('B');
1164-
assertElement3(
1164+
assertElement(
11651165
B._lookUpInheritedMethod('foo'),
11661166
declaration: findElement2.method('foo', of: 'M'),
11671167
);
@@ -1184,7 +1184,7 @@ mixin M2 {
11841184
class B extends A with M1, M2 {}
11851185
''');
11861186
var B = findElement2.class_('B');
1187-
assertElement3(
1187+
assertElement(
11881188
B._lookUpInheritedMethod('foo'),
11891189
declaration: findElement2.method('foo', of: 'M2'),
11901190
);
@@ -1205,7 +1205,7 @@ mixin M2 {}
12051205
class B extends A with M1, M2 {}
12061206
''');
12071207
var B = findElement2.class_('B');
1208-
assertElement3(
1208+
assertElement(
12091209
B._lookUpInheritedMethod('foo'),
12101210
declaration: findElement2.method('foo', of: 'M1'),
12111211
);
@@ -1222,7 +1222,7 @@ mixin M {}
12221222
class B extends A with M {}
12231223
''');
12241224
var B = findElement2.class_('B');
1225-
assertElement3(
1225+
assertElement(
12261226
B._lookUpInheritedMethod('foo'),
12271227
declaration: findElement2.method('foo', of: 'A'),
12281228
);
@@ -1241,7 +1241,7 @@ mixin M {
12411241
class B extends A with M {}
12421242
''');
12431243
var B = findElement2.class_('B');
1244-
assertElement3(
1244+
assertElement(
12451245
B._lookUpInheritedMethod('foo'),
12461246
declaration: findElement2.method('foo', of: 'A'),
12471247
);
@@ -1274,7 +1274,7 @@ class B {
12741274
class C extends A implements B {}
12751275
''');
12761276
var C = findElement2.class_('C');
1277-
assertElement3(
1277+
assertElement(
12781278
C._lookUpInheritedMethod('foo'),
12791279
declaration: findElement2.method('foo', of: 'A'),
12801280
);

pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'package:analyzer/src/dart/error/syntactic_errors.dart';
1313
import 'package:analyzer/src/dart/micro/resolve_file.dart';
1414
import 'package:analyzer/src/dart/micro/utils.dart';
1515
import 'package:analyzer/src/error/codes.dart';
16-
import 'package:analyzer/src/utilities/extensions/element.dart';
1716
import 'package:linter/src/lint_codes.dart';
1817
import 'package:test/test.dart';
1918
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -946,8 +945,11 @@ main() {
946945
int a = 0;
947946
var b = 1 + 2;
948947
''');
949-
assertType(findElement.topVar('a').type, 'int');
950-
assertElement(findNode.namedType('int a'), intElement.asElement);
948+
assertType(findElement2.topVar('a').type, 'int');
949+
assertElement(
950+
findNode.namedType('int a').element2,
951+
declaration: intElement,
952+
);
951953

952954
assertType(findElement.topVar('b').type, 'int');
953955
}

pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/src/error/codes.dart';
6+
import 'package:test/test.dart';
67
import 'package:test_reflective_loader/test_reflective_loader.dart';
78

89
import 'context_collection_resolution.dart';
@@ -1709,7 +1710,7 @@ void f() {
17091710
// getters and setters on `C`, and does not recover with other elements
17101711
// (methods, constructors). This prefixed identifier can have a real
17111712
// `staticElement` if we add such recovery.
1712-
assertElement(identifier, null);
1713+
expect(identifier.element, isNull);
17131714
}
17141715

17151716
test_constructorReference_inAssignment_onRightSide() async {

0 commit comments

Comments
 (0)