mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSSimplify] Adjust replaceTypeVariablesWithFreshPacks to propagate holes
If type variable that is being replaces allowed holes, the new one should not lose this property.
This commit is contained in:
committed by
Pavel Yaskevich
parent
38ee650719
commit
943ef19a1d
@@ -2412,13 +2412,16 @@ static PackType *replaceTypeVariablesWithFreshPacks(ConstraintSystem &cs,
|
||||
auto elementLoc = cs.getConstraintLocator(loc,
|
||||
LocatorPathElt::PackElement(freshTypeVars.size()));
|
||||
if (packExpansionElt != nullptr) {
|
||||
auto *freshTypeVar =
|
||||
cs.createTypeVariable(elementLoc, TVO_CanBindToPack);
|
||||
auto *freshTypeVar = cs.createTypeVariable(
|
||||
elementLoc,
|
||||
TVO_CanBindToPack |
|
||||
(typeVar->getImpl().canBindToHole() ? TVO_CanBindToHole : 0));
|
||||
freshTypeVars.push_back(PackExpansionType::get(
|
||||
freshTypeVar, packExpansionElt->getCountType()));
|
||||
} else {
|
||||
freshTypeVars.push_back(
|
||||
cs.createTypeVariable(elementLoc, /*options=*/0));
|
||||
freshTypeVars.push_back(cs.createTypeVariable(
|
||||
elementLoc,
|
||||
typeVar->getImpl().canBindToHole() ? TVO_CanBindToHole : 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user