mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Replace remaining uses of Type::transform() with transformRec()
This commit is contained in:
@@ -95,7 +95,7 @@ Type FailureDiagnostic::getRawType(ASTNode node) const {
|
||||
|
||||
Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
|
||||
bool wantRValue) const {
|
||||
rawType = rawType.transform([&](Type type) -> Type {
|
||||
rawType = rawType.transformRec([&](Type type) -> std::optional<Type> {
|
||||
if (auto *typeVar = type->getAs<TypeVariableType>()) {
|
||||
auto resolvedType = S.simplifyType(typeVar);
|
||||
|
||||
@@ -126,8 +126,10 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
|
||||
return env->mapElementTypeIntoPackContext(type);
|
||||
}
|
||||
|
||||
return type->isPlaceholder() ? Type(type->getASTContext().TheUnresolvedType)
|
||||
: type;
|
||||
if (type->isPlaceholder())
|
||||
return Type(type->getASTContext().TheUnresolvedType);
|
||||
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
if (reconstituteSugar)
|
||||
@@ -199,7 +201,7 @@ Type FailureDiagnostic::restoreGenericParameters(
|
||||
Type type,
|
||||
llvm::function_ref<void(GenericTypeParamType *, Type)> substitution) {
|
||||
llvm::SmallPtrSet<GenericTypeParamType *, 4> processed;
|
||||
return type.transform([&](Type type) -> Type {
|
||||
return type.transformRec([&](Type type) -> std::optional<Type> {
|
||||
if (auto *typeVar = type->getAs<TypeVariableType>()) {
|
||||
type = resolveType(typeVar);
|
||||
if (auto *GP = typeVar->getImpl().getGenericParameter()) {
|
||||
@@ -209,7 +211,7 @@ Type FailureDiagnostic::restoreGenericParameters(
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
return std::nullopt;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user