Skip to content

Commit 0f26da4

Browse files
committed
[Sema] WitnessMatching: Anchor requirement-witness type matching on a witness locator
1 parent 38a6d88 commit 0f26da4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/Sema/TypeCheckProtocol.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,6 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
10261026

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

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

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

0 commit comments

Comments
 (0)