Skip to content

Commit cf9e266

Browse files
committed
AST: Use getSuperclassForDecl() in one spot
1 parent ef58349 commit cf9e266

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/AST/Module.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,13 +663,11 @@ ModuleDecl::lookupConformance(Type type, ProtocolDecl *protocol) {
663663
if (auto inherited = dyn_cast<InheritedProtocolConformance>(conformance)) {
664664
// Dig out the conforming nominal type.
665665
auto rootConformance = inherited->getRootNormalConformance();
666-
auto conformingNominal
666+
auto conformingClass
667667
= rootConformance->getType()->getClassOrBoundGenericClass();
668668

669669
// Map up to our superclass's type.
670-
Type superclassTy = type->getSuperclass();
671-
while (superclassTy->getAnyNominal() != conformingNominal)
672-
superclassTy = superclassTy->getSuperclass();
670+
auto superclassTy = type->getSuperclassForDecl(conformingClass);
673671

674672
// Compute the conformance for the inherited type.
675673
auto inheritedConformance = lookupConformance(superclassTy, protocol);

0 commit comments

Comments
 (0)