22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- // ignore_for_file: analyzer_use_new_elements
6-
7- import 'package:analyzer/dart/element/element.dart' ;
5+ import 'package:analyzer/dart/element/element2.dart' ;
86import 'package:analyzer/dart/element/nullability_suffix.dart' ;
97import 'package:analyzer/dart/element/type.dart' ;
108import 'package:analyzer/src/dart/element/element.dart' ;
@@ -26,9 +24,9 @@ DynamicTypeImpl get dynamicType => DynamicTypeImpl.instance;
2624class FunctionTypeTest extends AbstractTypeSystemTest {
2725 InterfaceType get intType => typeProvider.intType;
2826
29- ClassElement get listElement => typeProvider.listElement ;
27+ ClassElement2 get listElement => typeProvider.listElement2 ;
3028
31- ClassElement get mapElement => typeProvider.mapElement ;
29+ ClassElement2 get mapElement => typeProvider.mapElement2 ;
3230
3331 InterfaceTypeImpl get objectType => typeProvider.objectType;
3432
@@ -56,9 +54,9 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
5654 reason: 'normalParameterTypes' );
5755 expect (f.optionalParameterTypes, optionalParameterTypes,
5856 reason: 'optionalParameterTypes' );
59- expect (f.parameters , parameters, reason: 'parameters' );
57+ expect (f.formalParameters , parameters, reason: 'parameters' );
6058 expect (f.returnType, returnType ?? same (dynamicType), reason: 'returnType' );
61- expect (f.typeFormals , typeFormals, reason: 'typeFormals' );
59+ expect (f.typeParameters , typeFormals, reason: 'typeFormals' );
6260 }
6361
6462 DartType listOf (DartType elementType) => listElement.instantiate (
@@ -416,11 +414,11 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
416414 namedParameter (name: 'b' , type: typeProvider.intType),
417415 ],
418416 );
419- var parameters = f.parameters ;
417+ var parameters = f.formalParameters ;
420418 expect (parameters, hasLength (3 ));
421- expect (parameters[0 ].name , 'a' );
422- expect (parameters[1 ].name , 'b' );
423- expect (parameters[2 ].name , 'c' );
419+ expect (parameters[0 ].name3 , 'a' );
420+ expect (parameters[1 ].name3 , 'b' );
421+ expect (parameters[2 ].name3 , 'c' );
424422 }
425423
426424 test_synthetic () {
@@ -486,9 +484,9 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
486484 displayName: 'dynamic Function({Object x})' ,
487485 namedParameterTypes: {'x' : same (objectType)},
488486 parameters: hasLength (1 ));
489- expect (f.parameters [0 ].isNamed, isTrue);
490- expect (f.parameters [0 ].name , 'x' );
491- expect (f.parameters [0 ].type, same (objectType));
487+ expect (f.formalParameters [0 ].isNamed, isTrue);
488+ expect (f.formalParameters [0 ].name3 , 'x' );
489+ expect (f.formalParameters [0 ].type, same (objectType));
492490 }
493491
494492 test_synthetic_normalParameter () {
@@ -504,9 +502,9 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
504502 normalParameterNames: ['x' ],
505503 normalParameterTypes: [same (objectType)],
506504 parameters: hasLength (1 ));
507- expect (f.parameters [0 ].isRequiredPositional, isTrue);
508- expect (f.parameters [0 ].name , 'x' );
509- expect (f.parameters [0 ].type, same (objectType));
505+ expect (f.formalParameters [0 ].isRequiredPositional, isTrue);
506+ expect (f.formalParameters [0 ].name3 , 'x' );
507+ expect (f.formalParameters [0 ].type, same (objectType));
510508 }
511509
512510 test_synthetic_optionalParameter () {
@@ -522,9 +520,9 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
522520 optionalParameterNames: ['x' ],
523521 optionalParameterTypes: [same (objectType)],
524522 parameters: hasLength (1 ));
525- expect (f.parameters [0 ].isOptionalPositional, isTrue);
526- expect (f.parameters [0 ].name , 'x' );
527- expect (f.parameters [0 ].type, same (objectType));
523+ expect (f.formalParameters [0 ].isOptionalPositional, isTrue);
524+ expect (f.formalParameters [0 ].name3 , 'x' );
525+ expect (f.formalParameters [0 ].type, same (objectType));
528526 }
529527
530528 test_synthetic_returnType () {
@@ -539,16 +537,16 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
539537 }
540538
541539 test_synthetic_typeFormals () {
542- var t = typeParameter ('T' );
543- FunctionType f = FunctionTypeImpl (
544- typeFormals : [t],
545- parameters : const [],
546- returnType: typeParameterTypeNone (t),
540+ var t = typeParameter2 ('T' );
541+ FunctionType f = FunctionTypeImpl . v2 (
542+ typeParameters : [t],
543+ formalParameters : const [],
544+ returnType: typeParameterTypeNone2 (t),
547545 nullabilitySuffix: NullabilitySuffix .none,
548546 );
549547 basicChecks (f,
550548 displayName: 'T Function<T>()' ,
551- returnType: typeParameterTypeNone (t),
549+ returnType: typeParameterTypeNone2 (t),
552550 typeFormals: [same (t)]);
553551 }
554552
0 commit comments