From 1731b09a88cb4a95e4d022ad32f4480c8841dba0 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 3 Oct 2025 14:01:57 -0400 Subject: [PATCH] AST: Don't return null Type() from getTypeWitness() --- lib/AST/ProtocolConformanceRef.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/AST/ProtocolConformanceRef.cpp b/lib/AST/ProtocolConformanceRef.cpp index d445040f7c2..0a1ecfa471b 100644 --- a/lib/AST/ProtocolConformanceRef.cpp +++ b/lib/AST/ProtocolConformanceRef.cpp @@ -202,8 +202,12 @@ Type ProtocolConformanceRef::getTypeWitness(AssociatedTypeDecl *assocType, auto conformingType = abstract->getType(); ASSERT(abstract->getProtocol() == assocType->getProtocol()); - if (auto *archetypeType = conformingType->getAs()) - return archetypeType->getNestedType(assocType); + if (auto *archetypeType = conformingType->getAs()) { + auto witnessType = archetypeType->getNestedType(assocType); + if (!witnessType) + return ErrorType::get(assocType->getASTContext()); + return witnessType; + } return DependentMemberType::get(conformingType, assocType); }