@@ -7472,8 +7472,15 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifySubclassOfConstraint(
7472
7472
// smaller constraints.
7473
7473
if (auto *packType = type->getAs<PackType>()) {
7474
7474
for (unsigned i = 0, e = packType->getNumElements(); i < e; ++i) {
7475
- addConstraint(ConstraintKind::SubclassOf, packType->getElementType(i),
7476
- classType, locator.withPathElement(LocatorPathElt::PackElement(i)));
7475
+ auto eltType = packType->getElementType(i);
7476
+ if (auto *packExpansionType = eltType->getAs<PackExpansionType>()) {
7477
+ // FIXME: Locator element for pack expansion pattern
7478
+ addConstraint(ConstraintKind::SubclassOf, packExpansionType->getPatternType(),
7479
+ classType, locator.withPathElement(LocatorPathElt::PackElement(i)));
7480
+ } else {
7481
+ addConstraint(ConstraintKind::SubclassOf, eltType,
7482
+ classType, locator.withPathElement(LocatorPathElt::PackElement(i)));
7483
+ }
7477
7484
}
7478
7485
7479
7486
return SolutionKind::Solved;
@@ -7583,9 +7590,18 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
7583
7590
// smaller constraints.
7584
7591
if (auto *packType = type->getAs<PackType>()) {
7585
7592
for (unsigned i = 0, e = packType->getNumElements(); i < e; ++i) {
7586
- addConstraint(ConstraintKind::ConformsTo, packType->getElementType(i),
7587
- protocol->getDeclaredInterfaceType(),
7588
- locator.withPathElement(LocatorPathElt::PackElement(i)));
7593
+ auto eltType = packType->getElementType(i);
7594
+ if (auto *packExpansionType = eltType->getAs<PackExpansionType>()) {
7595
+ // FIXME: Locator element for pack expansion pattern
7596
+ addConstraint(ConstraintKind::ConformsTo,
7597
+ packExpansionType->getPatternType(),
7598
+ protocol->getDeclaredInterfaceType(),
7599
+ locator.withPathElement(LocatorPathElt::PackElement(i)));
7600
+ } else {
7601
+ addConstraint(ConstraintKind::ConformsTo, eltType,
7602
+ protocol->getDeclaredInterfaceType(),
7603
+ locator.withPathElement(LocatorPathElt::PackElement(i)));
7604
+ }
7589
7605
}
7590
7606
7591
7607
return SolutionKind::Solved;
0 commit comments