[CSSimplify] If pack type has holes - its shape is a hole

Propagating holes to the shape helps avoid spurious diagnostics
about same-shape requirement failures.

Resolves: rdar://107675464
This commit is contained in:
Pavel Yaskevich
2023-04-26 09:18:46 -07:00
committed by Pavel Yaskevich
parent 3006f55327
commit 0db67464da
2 changed files with 27 additions and 0 deletions

View File

@@ -13269,6 +13269,14 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyShapeOfConstraint(
return formUnsolved();
}
if (type1->hasPlaceholder()) {
if (!shouldAttemptFixes())
return SolutionKind::Error;
recordTypeVariablesAsHoles(type2);
return SolutionKind::Solved;
}
auto shape = type1->getReducedShape();
addConstraint(ConstraintKind::Bind, shape, type2, locator);
return SolutionKind::Solved;