AST: Introduce PackElementType

This commit is contained in:
Slava Pestov
2023-05-22 13:47:24 -04:00
parent 8f9a4cbdae
commit b2bc2c72ec
29 changed files with 274 additions and 4 deletions

View File

@@ -7308,6 +7308,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
return matchPackExpansionTypes(expansion1, expansion2, kind, subflags,
locator);
}
case TypeKind::PackElement: {
auto pack1 = cast<PackElementType>(desugar1)->getPackType();
auto pack2 = cast<PackElementType>(desugar2)->getPackType();
return matchTypes(pack1, pack2, kind, subflags, locator);
}
}
}
@@ -7962,7 +7969,8 @@ ConstraintSystem::simplifyConstructionConstraint(
case TypeKind::InOut:
case TypeKind::Module:
case TypeKind::Pack:
case TypeKind::PackExpansion: {
case TypeKind::PackExpansion:
case TypeKind::PackElement: {
// If solver is in the diagnostic mode and this is an invalid base,
// let's give solver a chance to repair it to produce a good diagnostic.
if (shouldAttemptFixes())