mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ConstraintSystem] Add a locator path element for the pattern of a pack expansion.
This commit is contained in:
@@ -7559,9 +7559,10 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifySubclassOfConstraint(
|
||||
for (unsigned i = 0, e = packType->getNumElements(); i < e; ++i) {
|
||||
auto eltType = packType->getElementType(i);
|
||||
if (auto *packExpansionType = eltType->getAs<PackExpansionType>()) {
|
||||
// FIXME: Locator element for pack expansion pattern
|
||||
auto patternLoc =
|
||||
locator.withPathElement(ConstraintLocator::PackExpansionPattern);
|
||||
addConstraint(ConstraintKind::SubclassOf, packExpansionType->getPatternType(),
|
||||
classType, locator.withPathElement(LocatorPathElt::PackElement(i)));
|
||||
classType, patternLoc);
|
||||
} else {
|
||||
addConstraint(ConstraintKind::SubclassOf, eltType,
|
||||
classType, locator.withPathElement(LocatorPathElt::PackElement(i)));
|
||||
@@ -7677,11 +7678,12 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
for (unsigned i = 0, e = packType->getNumElements(); i < e; ++i) {
|
||||
auto eltType = packType->getElementType(i);
|
||||
if (auto *packExpansionType = eltType->getAs<PackExpansionType>()) {
|
||||
// FIXME: Locator element for pack expansion pattern
|
||||
auto patternLoc =
|
||||
locator.withPathElement(ConstraintLocator::PackExpansionPattern);
|
||||
addConstraint(ConstraintKind::ConformsTo,
|
||||
packExpansionType->getPatternType(),
|
||||
protocol->getDeclaredInterfaceType(),
|
||||
locator.withPathElement(LocatorPathElt::PackElement(i)));
|
||||
patternLoc);
|
||||
} else {
|
||||
addConstraint(ConstraintKind::ConformsTo, eltType,
|
||||
protocol->getDeclaredInterfaceType(),
|
||||
|
||||
Reference in New Issue
Block a user