[ConstraintSystem] implement implicit pack materialization for abstract tuples instead of explicit '.element'

This commit is contained in:
Sophia Poirier
2023-07-13 13:45:03 -07:00
parent 2d238bcea5
commit fa41015ae4
11 changed files with 149 additions and 40 deletions

View File

@@ -3614,9 +3614,8 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
// In the future, _if_ the syntax allows for multiple expansions
// this code would have to be adjusted to project l-value from the
// base type just like TupleIndex does.
auto tuple = choice.getBaseType()->getRValueType()->castTo<TupleType>();
auto *expansion = tuple->getElementType(0)->castTo<PackExpansionType>();
adjustedRefType = expansion->getPatternType();
adjustedRefType =
getPatternTypeOfSingleUnlabeledPackExpansionTuple(choice.getBaseType());
refType = adjustedRefType;
break;
}
@@ -3873,7 +3872,8 @@ struct TypeSimplifier {
if (typeVar->getImpl().isPackExpansion() &&
!resolvedType->isEqual(typeVar) &&
!resolvedType->is<PackExpansionType>() &&
!resolvedType->is<PackType>()) {
!resolvedType->is<PackType>() &&
!resolvedType->is<PackArchetypeType>()) {
return resolvedType;
}
}