AST: Don't return null Type() from getTypeWitness()

This commit is contained in:
Slava Pestov
2025-10-03 14:01:57 -04:00
parent ea0e0173b4
commit 1731b09a88

View File

@@ -202,8 +202,12 @@ Type ProtocolConformanceRef::getTypeWitness(AssociatedTypeDecl *assocType,
auto conformingType = abstract->getType();
ASSERT(abstract->getProtocol() == assocType->getProtocol());
if (auto *archetypeType = conformingType->getAs<ArchetypeType>())
return archetypeType->getNestedType(assocType);
if (auto *archetypeType = conformingType->getAs<ArchetypeType>()) {
auto witnessType = archetypeType->getNestedType(assocType);
if (!witnessType)
return ErrorType::get(assocType->getASTContext());
return witnessType;
}
return DependentMemberType::get(conformingType, assocType);
}