mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ConstraintSystem] Improve type parameter requirement locators
When opening generic types with type parameter requirements, add information about requirement location to the locator of each generated constraint to make it easier to extract such information if needed.
This commit is contained in:
@@ -1051,7 +1051,10 @@ void ConstraintSystem::openGeneric(
|
||||
bindArchetypesFromContext(*this, outerDC, locatorPtr, replacements);
|
||||
|
||||
// Add the requirements as constraints.
|
||||
for (auto req : sig->getRequirements()) {
|
||||
auto requirements = sig->getRequirements();
|
||||
for (unsigned pos = 0, n = requirements.size(); pos != n; ++pos) {
|
||||
const auto &req = requirements[pos];
|
||||
|
||||
Optional<Requirement> openedReq;
|
||||
auto openedFirst = openType(req.getFirstType(), replacements);
|
||||
|
||||
@@ -1078,7 +1081,11 @@ void ConstraintSystem::openGeneric(
|
||||
openedReq = Requirement(kind, openedFirst, req.getLayoutConstraint());
|
||||
break;
|
||||
}
|
||||
addConstraint(*openedReq, locatorPtr);
|
||||
|
||||
addConstraint(
|
||||
*openedReq,
|
||||
locator.withPathElement(ConstraintLocator::OpenedGeneric)
|
||||
.withPathElement(LocatorPathElt::getTypeRequirementComponent(pos)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user