@@ -268,7 +268,7 @@ Annotation
268268''' );
269269
270270 var localVariable = findElement2.localVar ('x' );
271- var annotationOnElement = localVariable.firstAnnotation ;
271+ var annotationOnElement = localVariable.metadata2.annotations.first ;
272272 _assertElementAnnotationValueText (annotationOnElement, '''
273273A
274274 a: int 3
@@ -1485,8 +1485,8 @@ import 'a.dart';
14851485void f(C c) {}
14861486''' );
14871487
1488- var classC = findNode.namedType ('C c' ).element2! ;
1489- var annotation = classC.firstAnnotation ;
1488+ var classC = findNode.namedType ('C c' ).element2 as ClassElement2 ;
1489+ var annotation = classC.metadata2.annotations.first ;
14901490 _assertElementAnnotationValueText (annotation, r'''
14911491B
14921492 a: A
@@ -1515,8 +1515,8 @@ import 'b.dart';
15151515void f(B b) {}
15161516''' );
15171517
1518- var classB = findNode.namedType ('B b' ).element2! ;
1519- var annotation = classB.firstAnnotation ;
1518+ var classB = findNode.namedType ('B b' ).element2! as ClassElement2 ;
1519+ var annotation = classB.metadata2.annotations.first ;
15201520 _assertElementAnnotationValueText (annotation, r'''
15211521A
15221522 f: int 42
@@ -1544,8 +1544,8 @@ import 'b.dart';
15441544void f(B b) {}
15451545''' );
15461546
1547- var classB = findNode.namedType ('B b' ).element2! ;
1548- var annotation = classB.firstAnnotation ;
1547+ var classB = findNode.namedType ('B b' ).element2 as ClassElement2 ;
1548+ var annotation = classB.metadata2.annotations.first ;
15491549 _assertElementAnnotationValueText (annotation, r'''
15501550A
15511551 f: int 42
@@ -2671,8 +2671,3 @@ int 42
26712671 assertDartObjectText (value, expected);
26722672 }
26732673}
2674-
2675- extension on Element2 {
2676- ElementAnnotation get firstAnnotation =>
2677- (this as Annotatable ).metadata2.annotations.first;
2678- }
0 commit comments