Skip to content

Commit 70f11c0

Browse files
committed
Sema: Remove a usage of DeclContext::getGenericParamsOfContext()
1 parent e28b0ec commit 70f11c0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/Sema/TypeCheckProtocolInference.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -932,17 +932,11 @@ AssociatedTypeInference::computeAbstractTypeWitness(
932932
}
933933

934934
// If there is a generic parameter of the named type, use that.
935-
if (auto gpList = dc->getGenericParamsOfContext()) {
936-
GenericTypeParamDecl *foundGP = nullptr;
937-
for (auto gp : *gpList) {
938-
if (gp->getName() == assocType->getName()) {
939-
foundGP = gp;
940-
break;
941-
}
935+
if (auto *genericSig = dc->getGenericSignatureOfContext()) {
936+
for (auto gp : genericSig->getInnermostGenericParams()) {
937+
if (gp->getName() == assocType->getName())
938+
return dc->mapTypeIntoContext(gp);
942939
}
943-
944-
if (foundGP)
945-
return dc->mapTypeIntoContext(foundGP->getDeclaredInterfaceType());
946940
}
947941

948942
return Type();

0 commit comments

Comments
 (0)