mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Don't return null Type() from getTypeWitness()
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user