Skip to content

Commit 86f9266

Browse files
committed
Sema: Fix invalid usage of SubstitutionMap::getProtocolSubstitutions()
1 parent 4a8b7bd commit 86f9266

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3742,8 +3742,9 @@ filterProtocolRequirements(
37423742

37433743
const auto getProtocolSubstitutionMap = [&](ValueDecl *Req) {
37443744
auto *const PD = cast<ProtocolDecl>(Req->getDeclContext());
3745+
auto Conformance = lookupConformance(Adoptee, PD);
37453746
return SubstitutionMap::getProtocolSubstitutions(
3746-
PD, Adoptee, ProtocolConformanceRef(PD));
3747+
PD, Adoptee, Conformance);
37473748
};
37483749

37493750
llvm::SmallDenseMap<DeclName, llvm::SmallVector<ValueDecl *, 2>, 4>
@@ -5058,7 +5059,7 @@ hasInvalidTypeInConformanceContext(const ValueDecl *requirement,
50585059

50595060
const auto subs = SubstitutionMap::getProtocolSubstitutions(
50605061
conformance->getProtocol(),
5061-
conformance->getDeclContext()->mapTypeIntoContext(conformance->getType()),
5062+
conformance->getType(),
50625063
ProtocolConformanceRef(conformance));
50635064

50645065
class Walker final : public TypeWalker {

0 commit comments

Comments
 (0)