Skip to content

Commit da067e8

Browse files
committed
[Sema] WitnessMatching: Anchor requirement-witness type matching on a witness locator
(cherry picked from commit 0f26da4)
1 parent 8beb09a commit da067e8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,6 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
10271027

10281028
// Initialized by the setup operation.
10291029
std::optional<ConstraintSystem> cs;
1030-
ConstraintLocator *locator = nullptr;
10311030
ConstraintLocator *reqLocator = nullptr;
10321031
ConstraintLocator *witnessLocator = nullptr;
10331032
Type witnessType, openWitnessType;
@@ -1152,8 +1151,6 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
11521151

11531152
// Open up the witness type.
11541153
witnessType = witness->getInterfaceType();
1155-
// FIXME: witness as a base locator?
1156-
locator = cs->getConstraintLocator({});
11571154
witnessLocator =
11581155
cs->getConstraintLocator(req, LocatorPathElt::Witness(witness));
11591156
if (witness->getDeclContext()->isTypeContext()) {
@@ -1212,7 +1209,8 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
12121209
}
12131210
}
12141211

1215-
cs->addConstraint(ConstraintKind::Bind, reqType, witnessType, locator);
1212+
cs->addConstraint(ConstraintKind::Bind, reqType, witnessType,
1213+
witnessLocator);
12161214
// FIXME: Check whether this has already failed.
12171215
return std::nullopt;
12181216
};

0 commit comments

Comments
 (0)