@@ -2975,19 +2975,19 @@ static Type substType(Type derivedType,
29752975 !derivedType->is <GenericFunctionType>())
29762976 return derivedType;
29772977
2978- return derivedType.transform ([&](Type type) -> Type {
2978+ return derivedType.transformRec ([&](TypeBase * type) -> Optional< Type> {
29792979 // FIXME: Add SIL versions of mapTypeIntoContext() and
29802980 // mapTypeOutOfContext() and use them appropriately
29812981 assert ((options.contains (SubstFlags::AllowLoweredTypes) ||
2982- !isa<SILFunctionType>(type. getPointer () )) &&
2982+ !isa<SILFunctionType>(type)) &&
29832983 " should not be doing AST type-substitution on a lowered SIL type;"
29842984 " use SILType::subst" );
29852985
29862986 // Special-case handle SILBoxTypes; we want to structurally substitute the
29872987 // substitutions.
2988- if (auto boxTy = dyn_cast<SILBoxType>(type. getPointer () )) {
2988+ if (auto boxTy = dyn_cast<SILBoxType>(type)) {
29892989 if (boxTy->getGenericArgs ().empty ())
2990- return boxTy;
2990+ return Type ( boxTy) ;
29912991
29922992 SmallVector<Substitution, 4 > substArgs;
29932993 for (auto &arg : boxTy->getGenericArgs ()) {
@@ -3007,7 +3007,7 @@ static Type substType(Type derivedType,
30073007
30083008 // For dependent member types, we may need to look up the member if the
30093009 // base is resolved to a non-dependent type.
3010- if (auto depMemTy = dyn_cast<DependentMemberType>(type. getPointer () )) {
3010+ if (auto depMemTy = dyn_cast<DependentMemberType>(type)) {
30113011 auto newBase = substType (depMemTy->getBase (),
30123012 substitutions, lookupConformances, options);
30133013 if (!newBase)
@@ -3019,29 +3019,29 @@ static Type substType(Type derivedType,
30193019 depMemTy->getName (), options);
30203020 }
30213021
3022- auto substOrig = dyn_cast<SubstitutableType>(type. getPointer () );
3022+ auto substOrig = dyn_cast<SubstitutableType>(type);
30233023 if (!substOrig)
3024- return type ;
3024+ return None ;
30253025
30263026 // If we have a substitution for this type, use it.
30273027 if (auto known = substitutions (substOrig))
30283028 return known;
30293029
30303030 // If we failed to substitute a generic type parameter, give up.
3031- if (substOrig-> is <GenericTypeParamType>()) {
3031+ if (isa <GenericTypeParamType>(substOrig )) {
30323032 if (options.contains (SubstFlags::UseErrorType))
30333033 return ErrorType::get (type);
3034- return type;
3034+ return Type ( type) ;
30353035 }
30363036
3037- auto archetype = substOrig-> castTo <ArchetypeType>();
3037+ auto archetype = cast <ArchetypeType>(substOrig );
30383038
30393039 // For archetypes, we can substitute the parent (if present).
30403040 auto parent = archetype->getParent ();
30413041 if (!parent) {
30423042 if (options.contains (SubstFlags::UseErrorType))
30433043 return ErrorType::get (type);
3044- return type;
3044+ return Type ( type) ;
30453045 }
30463046
30473047 // Substitute into the parent type.
@@ -3050,7 +3050,7 @@ static Type substType(Type derivedType,
30503050
30513051 // If the parent didn't change, we won't change.
30523052 if (substParent.getPointer () == parent)
3053- return type;
3053+ return Type ( type) ;
30543054
30553055 // Get the associated type reference from a child archetype.
30563056 AssociatedTypeDecl *assocType = archetype->getAssocType ();
0 commit comments