@@ -316,6 +316,7 @@ class FunctionTypeImpl extends TypeImpl
316316 );
317317 }
318318
319+ @Deprecated ('Use referencesAny2() instead' )
319320 @override
320321 bool referencesAny (Set <TypeParameterElementImpl > parameters) {
321322 if (typeFormals.any ((element) {
@@ -396,8 +397,9 @@ class FunctionTypeImpl extends TypeImpl
396397 return instantiate ([
397398 for (var i = 0 ; i < typeFormals.length; i++ )
398399 TypeParameterTypeImpl (
399- element: TypeParameterElementImpl .synthetic ('T$i ' ),
400- nullabilitySuffix: NullabilitySuffix .none)
400+ element3: TypeParameterElementImpl .synthetic ('T$i ' ).element,
401+ nullabilitySuffix: NullabilitySuffix .none,
402+ )
401403 ]).hashCode;
402404 }
403405
@@ -1138,6 +1140,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
11381140 return null ;
11391141 }
11401142
1143+ @Deprecated ('Use referencesAny2() instead' )
11411144 @override
11421145 bool referencesAny (Set <TypeParameterElementImpl > parameters) {
11431146 return typeArguments.any ((argument) => argument.referencesAny (parameters));
@@ -1629,6 +1632,7 @@ abstract class TypeImpl implements DartType, SharedType {
16291632 bool isStructurallyEqualTo (Object other) => this == other;
16301633
16311634 /// Returns true if this type references any of the [parameters] .
1635+ @Deprecated ('Use referencesAny2() instead' )
16321636 bool referencesAny (Set <TypeParameterElementImpl > parameters) {
16331637 return false ;
16341638 }
@@ -1672,60 +1676,42 @@ abstract class TypeImpl implements DartType, SharedType {
16721676/// A concrete implementation of a [TypeParameterType] .
16731677class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
16741678 @override
1675- final TypeParameterElementImpl element ;
1679+ final TypeParameterElementImpl2 element3 ;
16761680
16771681 @override
16781682 final NullabilitySuffix nullabilitySuffix;
16791683
16801684 /// An optional promoted bound on the type parameter.
16811685 ///
16821686 /// 'null' indicates that the type parameter's bound has not been promoted and
1683- /// is therefore the same as the bound of [element ] .
1687+ /// is therefore the same as the bound of [element3 ] .
16841688 final TypeImpl ? promotedBound;
16851689
16861690 /// Initialize a newly created type parameter type to be declared by the given
1687- /// [element ] and to have the given name.
1691+ /// [element3 ] and to have the given name.
16881692 TypeParameterTypeImpl ({
1689- required TypeParameterElement element ,
1693+ required this .element3 ,
16901694 required this .nullabilitySuffix,
16911695 DartType ? promotedBound,
16921696 super .alias,
1693- }) :
1694- // TODO(paulberry): change the type of the parameter `element` so
1695- // that this cast isn't needed.
1696- element = element as TypeParameterElementImpl ,
1697- // TODO(paulberry): change the type of the parameter `promotedBound` so
1697+ }) : // TODO(paulberry): change the type of the parameter `promotedBound` so
16981698 // that this cast isn't needed.
16991699 promotedBound = promotedBound as TypeImpl ? ;
17001700
1701- /// Initialize a newly created type parameter type to be declared by the given
1702- /// [element] and to have the given name.
1703- factory TypeParameterTypeImpl .v2 ({
1704- required TypeParameterElement2 element,
1705- required NullabilitySuffix nullabilitySuffix,
1706- DartType ? promotedBound,
1707- InstantiatedTypeAliasElementImpl ? alias,
1708- }) {
1709- return TypeParameterTypeImpl (
1710- element: element.asElement,
1711- nullabilitySuffix: nullabilitySuffix,
1712- promotedBound: promotedBound,
1713- alias: alias,
1714- );
1715- }
1716-
17171701 @override
17181702 TypeImpl get bound =>
1719- promotedBound ?? element .bound ?? DynamicTypeImpl .instance;
1703+ promotedBound ?? element3 .bound ?? DynamicTypeImpl .instance;
17201704
1705+ @Deprecated ('Elements are equal when they are identical' )
17211706 @override
17221707 ElementLocation get definition => element.location;
17231708
1709+ @Deprecated ('Use element3 instead' )
17241710 @override
1725- TypeParameterElementImpl2 get element3 => element.element ;
1711+ TypeParameterElementImpl get element => element3.asElement ;
17261712
17271713 @override
1728- int get hashCode => element .hashCode;
1714+ int get hashCode => element3 .hashCode;
17291715
17301716 @override
17311717 bool get isBottom {
@@ -1755,7 +1741,7 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
17551741
17561742 TypeParameterTypeImpl get withoutPromotedBound {
17571743 return TypeParameterTypeImpl (
1758- element : element ,
1744+ element3 : element3 ,
17591745 nullabilitySuffix: nullabilitySuffix,
17601746 );
17611747 }
@@ -1766,7 +1752,7 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
17661752 return true ;
17671753 }
17681754
1769- if (other is TypeParameterTypeImpl && other.element == element ) {
1755+ if (other is TypeParameterTypeImpl && other.element3 == element3 ) {
17701756 if (other.nullabilitySuffix != nullabilitySuffix) {
17711757 return false ;
17721758 }
@@ -1804,6 +1790,7 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
18041790 return bound.asInstanceOf2 (targetElement);
18051791 }
18061792
1793+ @Deprecated ('Use referencesAny2() instead' )
18071794 @override
18081795 bool referencesAny (Set <TypeParameterElement > parameters) {
18091796 return parameters.contains (element);
@@ -1818,7 +1805,7 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
18181805 TypeImpl withNullability (NullabilitySuffix nullabilitySuffix) {
18191806 if (this .nullabilitySuffix == nullabilitySuffix) return this ;
18201807 return TypeParameterTypeImpl (
1821- element : element ,
1808+ element3 : element3 ,
18221809 nullabilitySuffix: nullabilitySuffix,
18231810 promotedBound: promotedBound,
18241811 );
0 commit comments