AST: Replace remaining uses of Type::transform() with transformRec()

This commit is contained in:
Slava Pestov
2024-08-12 14:00:33 -04:00
parent d35af38ce4
commit b601c294ac
22 changed files with 154 additions and 174 deletions

View File

@@ -91,11 +91,11 @@ public:
// it means that this is an invalid external declaration
// relative to this element's context.
if (CS.simplifyType(type)->hasTypeVariable()) {
auto transformedTy = type.transform([&](Type type) {
auto transformedTy = type.transformRec([&](Type type) -> std::optional<Type> {
if (auto *typeVar = type->getAs<TypeVariableType>()) {
return ErrorType::get(CS.getASTContext());
return Type(ErrorType::get(CS.getASTContext()));
}
return type;
return std::nullopt;
});
CS.setType(decl, transformedTy);