@@ -281,7 +281,7 @@ class FunctionTypeImpl extends TypeImpl
281281 }
282282
283283 return other.returnType == returnType &&
284- _equalParameters (other.parameters, parameters );
284+ _equalParameters (other.formalParameters, formalParameters );
285285 }
286286 return false ;
287287 }
@@ -441,32 +441,26 @@ class FunctionTypeImpl extends TypeImpl
441441 FunctionType f1,
442442 FunctionType f2,
443443 bool Function (DartType bound2, DartType bound1) relation) {
444- List <TypeParameterElement > params1 = f1.typeFormals;
445- List <TypeParameterElement > params2 = f2.typeFormals;
446- return relateTypeFormals2 (params1, params2, relation);
447- }
444+ List <TypeParameterElement2 > params1 = f1.typeParameters;
445+ List <TypeParameterElement2 > params2 = f2.typeParameters;
448446
449- static List <TypeParameterType >? relateTypeFormals2 (
450- List <TypeParameterElement > params1,
451- List <TypeParameterElement > params2,
452- bool Function (DartType bound2, DartType bound1) relation) {
453447 int count = params1.length;
454448 if (params2.length != count) {
455449 return null ;
456450 }
457451 // We build up a substitution matching up the type parameters
458452 // from the two types, {variablesFresh/variables1} and
459453 // {variablesFresh/variables2}
460- List <TypeParameterElement > variables1 = < TypeParameterElement > [];
461- List <TypeParameterElement > variables2 = < TypeParameterElement > [];
462- var variablesFresh = < TypeParameterType > [];
454+ List <TypeParameterElement2 > variables1 = < TypeParameterElement2 > [];
455+ List <TypeParameterElement2 > variables2 = < TypeParameterElement2 > [];
456+ List < TypeParameterType > variablesFresh = < TypeParameterType > [];
463457 for (int i = 0 ; i < count; i++ ) {
464- TypeParameterElement p1 = params1[i];
465- TypeParameterElement p2 = params2[i];
458+ TypeParameterElement2 p1 = params1[i];
459+ TypeParameterElement2 p2 = params2[i];
466460 TypeParameterElementImpl pFresh =
467- TypeParameterElementImpl .synthetic (p2.name );
461+ TypeParameterElementImpl .synthetic (p2.name3 ! );
468462
469- var variableFresh = pFresh.instantiate (
463+ TypeParameterTypeImpl variableFresh = pFresh.instantiate (
470464 nullabilitySuffix: NullabilitySuffix .none,
471465 );
472466
@@ -476,9 +470,9 @@ class FunctionTypeImpl extends TypeImpl
476470
477471 DartType bound1 = p1.bound ?? DynamicTypeImpl .instance;
478472 DartType bound2 = p2.bound ?? DynamicTypeImpl .instance;
479- bound1 = Substitution .fromPairs (variables1, variablesFresh)
473+ bound1 = Substitution .fromPairs2 (variables1, variablesFresh)
480474 .substituteType (bound1);
481- bound2 = Substitution .fromPairs (variables2, variablesFresh)
475+ bound2 = Substitution .fromPairs2 (variables2, variablesFresh)
482476 .substituteType (bound2);
483477 if (! relation (bound2, bound1)) {
484478 return null ;
@@ -496,24 +490,26 @@ class FunctionTypeImpl extends TypeImpl
496490 /// the same types. Named parameters must also have same names. Named
497491 /// parameters must be sorted in the given lists.
498492 static bool _equalParameters (
499- List <ParameterElement > firstParameters,
500- List <ParameterElement > secondParameters,
493+ List <FormalParameterElement > firstParameters,
494+ List <FormalParameterElement > secondParameters,
501495 ) {
502496 if (firstParameters.length != secondParameters.length) {
503497 return false ;
504498 }
505499 for (var i = 0 ; i < firstParameters.length; ++ i) {
506500 var firstParameter = firstParameters[i];
507501 var secondParameter = secondParameters[i];
508- // ignore: deprecated_member_use_from_same_package
509- if (firstParameter.parameterKind != secondParameter.parameterKind) {
502+ if (firstParameter.isPositional != secondParameter.isPositional) {
503+ return false ;
504+ }
505+ if (firstParameter.isOptional != secondParameter.isOptional) {
510506 return false ;
511507 }
512508 if (firstParameter.type != secondParameter.type) {
513509 return false ;
514510 }
515511 if (firstParameter.isNamed &&
516- firstParameter.name != secondParameter.name ) {
512+ firstParameter.name3 != secondParameter.name3 ) {
517513 return false ;
518514 }
519515 }
0 commit comments