Skip to content

Commit 4d501ef

Browse files
committed
[Sema] WitnessMatching: Anchor witness on the requirement declaration
1 parent 31e385f commit 4d501ef

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Sema/CSSimplify.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8597,7 +8597,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
85978597
auto synthesizeConformance = [&]() {
85988598
ProtocolConformanceRef synthesized(protocol);
85998599
auto witnessLoc = getConstraintLocator(
8600-
/*anchor=*/{}, LocatorPathElt::Witness(witness));
8600+
locator.getAnchor(), LocatorPathElt::Witness(witness));
86018601
SynthesizedConformances.insert({witnessLoc, synthesized});
86028602
return recordConformance(synthesized);
86038603
};

lib/Sema/TypeCheckProtocol.cpp

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

0 commit comments

Comments
 (0)