@@ -652,10 +652,11 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
652652 @override
653653 List <InterfaceTypeImpl > get allSupertypes {
654654 var substitution = Substitution .fromInterfaceType (this );
655- return element3.allSupertypes
656- .map ((t) => (substitution.substituteType (t) as InterfaceTypeImpl )
657- .withNullability (nullabilitySuffix))
658- .toList ();
655+ return element3.allSupertypes.map ((interface ) {
656+ return substitution
657+ .mapInterfaceType (interface )
658+ .withNullability (nullabilitySuffix);
659+ }).toList ();
659660 }
660661
661662 @Deprecated ('Use constructors2 instead' )
@@ -823,8 +824,8 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
823824 return null ;
824825 }
825826
826- return ( Substitution .fromInterfaceType (this ). substituteType (supertype )
827- as InterfaceTypeImpl )
827+ return Substitution .fromInterfaceType (this )
828+ . mapInterfaceType (supertype )
828829 .withNullability (nullabilitySuffix);
829830 }
830831
@@ -887,7 +888,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
887888 for (var rawInterface in element.allSupertypes) {
888889 if (rawInterface.element == targetElement) {
889890 var substitution = Substitution .fromInterfaceType (this );
890- return substitution.substituteType (rawInterface) as InterfaceTypeImpl ;
891+ return substitution.mapInterfaceType (rawInterface);
891892 }
892893 }
893894
@@ -903,7 +904,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
903904 for (var rawInterface in element3.allSupertypes) {
904905 if (rawInterface.element3 == targetElement) {
905906 var substitution = Substitution .fromInterfaceType (this );
906- return substitution.substituteType (rawInterface) as InterfaceTypeImpl ;
907+ return substitution.mapInterfaceType (rawInterface);
907908 }
908909 }
909910
0 commit comments