Skip to content

Commit 38b5a8b

Browse files
committed
[Sema] WitnessMatching: Anchor witness on the requirement declaration
(cherry picked from commit 4d501ef)
1 parent 75c65cb commit 38b5a8b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8552,7 +8552,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
85528552
auto synthesizeConformance = [&]() {
85538553
ProtocolConformanceRef synthesized(protocol);
85548554
auto witnessLoc = getConstraintLocator(
8555-
/*anchor=*/{}, LocatorPathElt::Witness(witness));
8555+
locator.getAnchor(), LocatorPathElt::Witness(witness));
85568556
SynthesizedConformances.insert({witnessLoc, synthesized});
85578557
return recordConformance(synthesized);
85588558
};

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,8 +1154,8 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
11541154
witnessType = witness->getInterfaceType();
11551155
// FIXME: witness as a base locator?
11561156
locator = cs->getConstraintLocator({});
1157-
witnessLocator = cs->getConstraintLocator({},
1158-
LocatorPathElt::Witness(witness));
1157+
witnessLocator =
1158+
cs->getConstraintLocator(req, LocatorPathElt::Witness(witness));
11591159
if (witness->getDeclContext()->isTypeContext()) {
11601160
openWitnessType = cs->getTypeOfMemberReference(
11611161
selfTy, witness, dc, /*isDynamicResult=*/false,

0 commit comments

Comments
 (0)