[ConstraintSystem] Use fallback type constraint to default pack expansion

Binding of pack expansion types is delayed until solving but use
of `Defaultable` was preventing it from being considered early
because that constraint impacts binding set ranking, switching
to `FallbackType` constraint give us better semantics where pack
expansion type variables are going to be bound as soon as they
have a contextual type.

Resolves: rdar://110819621
This commit is contained in:
Pavel Yaskevich
2023-06-16 09:31:23 -07:00
parent 2ee646f47b
commit 83bb9c1f5a
2 changed files with 43 additions and 1 deletions

View File

@@ -1031,7 +1031,7 @@ Type ConstraintSystem::openPackExpansionType(PackExpansionType *expansion,
// This constraint is important to make sure that pack expansion always
// has a binding and connect pack expansion var to any type variables
// that appear in pattern and shape types.
addUnsolvedConstraint(Constraint::create(*this, ConstraintKind::Defaultable,
addUnsolvedConstraint(Constraint::create(*this, ConstraintKind::FallbackType,
expansionVar, openedPackExpansion,
expansionLoc));