Skip to content

Commit 4d87f25

Browse files
committed
Sema: Fix another call to SubstitutionMap::getProtocolSubstitutions()
The conforming type didn't match the conformance, which is going to be flagged by SubstitutionMap::verify().
1 parent 5d40673 commit 4d87f25

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4887,10 +4887,16 @@ static void ensureRequirementsAreSatisfied(ASTContext &ctx,
48874887
auto proto = conformance->getProtocol();
48884888
auto &diags = ctx.Diags;
48894889

4890-
auto *const module = dc->getParentModule();
4891-
auto substitutingType = dc->mapTypeIntoContext(conformance->getType());
4890+
auto typeInContext = conformance->getType();
4891+
ProtocolConformanceRef conformanceInContext(conformance);
4892+
if (auto *genericEnv = conformance->getGenericEnvironment()) {
4893+
typeInContext = genericEnv->mapTypeIntoContext(typeInContext);
4894+
conformanceInContext =
4895+
conformanceInContext.subst(conformance->getType(),
4896+
genericEnv->getForwardingSubstitutionMap());
4897+
}
48924898
auto substitutions = SubstitutionMap::getProtocolSubstitutions(
4893-
proto, substitutingType, ProtocolConformanceRef(conformance));
4899+
proto, typeInContext, conformanceInContext);
48944900

48954901
auto reqSig = proto->getRequirementSignature().getRequirements();
48964902

0 commit comments

Comments
 (0)