Skip to content

Commit 1d87bc2

Browse files
committed
AST: Simplify getOverrideGenericSignature()
1 parent 4e658b8 commit 1d87bc2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/AST/ASTContext.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5328,20 +5328,16 @@ ASTContext::getOverrideGenericSignature(const NominalTypeDecl *baseNominal,
53285328
addedRequirements.push_back(reqt);
53295329
}
53305330
} else {
5331-
const auto derivedSuperclass = cast<ClassDecl>(derivedNominal)
5332-
->getSuperclass();
5333-
if (derivedSuperclass.isNull())
5334-
return nullptr;
5335-
53365331
unsigned derivedDepth = 0;
53375332
unsigned baseDepth = 0;
53385333
if (derivedNominalSig)
53395334
derivedDepth = derivedNominalSig.getGenericParams().back()->getDepth() + 1;
53405335
if (const auto baseNominalSig = baseNominal->getGenericSignature())
53415336
baseDepth = baseNominalSig.getGenericParams().back()->getDepth() + 1;
53425337

5343-
const auto subMap = derivedSuperclass->getContextSubstitutionMap(
5344-
derivedNominal->getModuleContext(), baseNominal);
5338+
const auto subMap = derivedNominal->getDeclaredInterfaceType()
5339+
->getContextSubstitutionMap(derivedNominal->getModuleContext(),
5340+
baseNominal);
53455341

53465342
auto substFn = [&](SubstitutableType *type) -> Type {
53475343
auto *gp = cast<GenericTypeParamType>(type);

0 commit comments

Comments
 (0)