Merge pull request #66708 from xedin/generalize-default-closure-type-constraint

[ConstraintSystem] Use fallback type constraint to default pack expansion
This commit is contained in:
Pavel Yaskevich
2023-06-19 00:47:18 -07:00
committed by GitHub
9 changed files with 91 additions and 51 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));
@@ -7419,7 +7419,7 @@ bool TypeVarBindingProducer::requiresOptionalAdjustment(
PotentialBinding
TypeVarBindingProducer::getDefaultBinding(Constraint *constraint) const {
assert(constraint->getKind() == ConstraintKind::Defaultable ||
constraint->getKind() == ConstraintKind::DefaultClosureType);
constraint->getKind() == ConstraintKind::FallbackType);
auto type = constraint->getSecondType();
Binding binding{type, BindingKind::Exact, constraint};