@@ -15,7 +15,6 @@ import 'package:analyzer/src/dart/element/member.dart';
1515import 'package:analyzer/src/dart/element/type_algebra.dart' ;
1616import 'package:analyzer/src/dart/element/type_system.dart' ;
1717import 'package:analyzer/src/utilities/extensions/collection.dart' ;
18- import 'package:analyzer/src/utilities/extensions/element.dart' ;
1918import 'package:collection/collection.dart' ;
2019
2120/// Returns a [List] of fixed length with given types.
@@ -92,9 +91,8 @@ class FunctionTypeImpl extends TypeImpl
9291 @override
9392 final TypeImpl returnType;
9493
95- /// The formal type parameters of this generic function; for example,
96- /// `<T> T -> T` .
97- final List <TypeParameterFragmentImpl > typeFormals;
94+ @override
95+ final List <TypeParameterElementImpl > typeParameters;
9896
9997 /// A list containing the parameters elements of this type of function.
10098 ///
@@ -126,7 +124,7 @@ class FunctionTypeImpl extends TypeImpl
126124 final List <FormalParameterElementMixin > sortedNamedParameters;
127125
128126 factory FunctionTypeImpl ({
129- required List <TypeParameterFragmentImpl > typeFormals ,
127+ required List <TypeParameterElementImpl > typeParameters ,
130128 required List <FormalParameterElementMixin > parameters,
131129 required TypeImpl returnType,
132130 required NullabilitySuffix nullabilitySuffix,
@@ -176,7 +174,7 @@ class FunctionTypeImpl extends TypeImpl
176174 );
177175 }
178176 return FunctionTypeImpl ._(
179- typeFormals : typeFormals ,
177+ typeParameters : typeParameters ,
180178 parameters: parameters,
181179 returnType: returnType,
182180 nullabilitySuffix: nullabilitySuffix,
@@ -195,7 +193,7 @@ class FunctionTypeImpl extends TypeImpl
195193 InstantiatedTypeAliasElementImpl ? alias,
196194 }) {
197195 return FunctionTypeImpl (
198- typeFormals : typeParameters. map ((e) => e.asElement). toList () ,
196+ typeParameters : typeParameters,
199197 parameters: formalParameters,
200198 returnType: returnType,
201199 nullabilitySuffix: nullabilitySuffix,
@@ -204,7 +202,7 @@ class FunctionTypeImpl extends TypeImpl
204202 }
205203
206204 FunctionTypeImpl ._({
207- required this .typeFormals ,
205+ required this .typeParameters ,
208206 required this .parameters,
209207 required this .returnType,
210208 required this .nullabilitySuffix,
@@ -254,10 +252,6 @@ class FunctionTypeImpl extends TypeImpl
254252 List <FormalParameterElementMixin > get sortedNamedParametersShared =>
255253 sortedNamedParameters;
256254
257- @override
258- List <TypeParameterElementImpl > get typeParameters =>
259- typeFormals.map ((fragment) => fragment.element).toList ();
260-
261255 @override
262256 List <TypeParameterElementImpl > get typeParametersShared => typeParameters;
263257
@@ -272,13 +266,13 @@ class FunctionTypeImpl extends TypeImpl
272266 return false ;
273267 }
274268
275- if (other.typeFormals .length != typeFormals .length) {
269+ if (other.typeParameters .length != typeParameters .length) {
276270 return false ;
277271 }
278272 // `<T>T -> T` should be equal to `<U>U -> U`
279273 // To test this, we instantiate both types with the same (unique) type
280274 // variables, and see if the result is equal.
281- if (typeFormals .isNotEmpty) {
275+ if (typeParameters .isNotEmpty) {
282276 var freshVariables = FunctionTypeImpl .relateTypeFormals (
283277 this ,
284278 other,
@@ -330,7 +324,7 @@ class FunctionTypeImpl extends TypeImpl
330324
331325 return FunctionTypeImpl (
332326 returnType: substitution.substituteType (returnType),
333- typeFormals : const [],
327+ typeParameters : const [],
334328 parameters:
335329 parameters
336330 .map ((p) => ParameterMember .from2 (p, substitution))
@@ -341,8 +335,8 @@ class FunctionTypeImpl extends TypeImpl
341335
342336 @override
343337 bool referencesAny (Set <TypeParameterElementImpl > parameters) {
344- if (typeFormals .any ((element) {
345- assert (! parameters.contains (element.asElement2 ));
338+ if (typeParameters .any ((element) {
339+ assert (! parameters.contains (element));
346340
347341 var bound = element.bound;
348342 if (bound != null && bound.referencesAny (parameters)) {
@@ -369,7 +363,7 @@ class FunctionTypeImpl extends TypeImpl
369363 TypeImpl withNullability (NullabilitySuffix nullabilitySuffix) {
370364 if (this .nullabilitySuffix == nullabilitySuffix) return this ;
371365 return FunctionTypeImpl ._(
372- typeFormals : typeFormals ,
366+ typeParameters : typeParameters ,
373367 parameters: parameters,
374368 returnType: returnType,
375369 nullabilitySuffix: nullabilitySuffix,
@@ -381,7 +375,7 @@ class FunctionTypeImpl extends TypeImpl
381375 }
382376
383377 int _computeHashCode () {
384- if (typeFormals .isNotEmpty) {
378+ if (typeParameters .isNotEmpty) {
385379 // Two generic function types are considered equivalent even if their type
386380 // formals have different names, so we need to normalize to a standard set
387381 // of type formals before taking the hash code.
@@ -391,7 +385,7 @@ class FunctionTypeImpl extends TypeImpl
391385 // parameter bounds will receive the same hash code; this should be rare
392386 // enough that it won't be a problem.
393387 return instantiate ([
394- for (var i = 0 ; i < typeFormals .length; i++ )
388+ for (var i = 0 ; i < typeParameters .length; i++ )
395389 TypeParameterTypeImpl (
396390 element: TypeParameterFragmentImpl .synthetic (name2: 'T$i ' ).element,
397391 nullabilitySuffix: NullabilitySuffix .none,
0 commit comments