File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -4282,16 +4282,17 @@ ConstraintSystem::matchTypesBindTypeVar(
4282
4282
// pack expansion expression.
4283
4283
if (!typeVar->getImpl().canBindToPack() &&
4284
4284
(type->is<PackArchetypeType>() || type->is<PackType>())) {
4285
- if (shouldAttemptFixes()) {
4286
- auto *fix = AllowInvalidPackReference::create(*this, type,
4287
- getConstraintLocator(locator));
4288
- if (!recordFix(fix)) {
4289
- recordPotentialHole(typeVar);
4290
- return getTypeMatchSuccess();
4291
- }
4292
- }
4285
+ if (!shouldAttemptFixes())
4286
+ return getTypeMatchFailure(locator);
4293
4287
4294
- return getTypeMatchFailure(locator);
4288
+ auto *fix = AllowInvalidPackReference::create(
4289
+ *this, type, getConstraintLocator(locator));
4290
+ if (recordFix(fix))
4291
+ return getTypeMatchFailure(locator);
4292
+
4293
+ // Don't allow the invalid pack reference to propagate to other
4294
+ // bindings.
4295
+ type = PlaceholderType::get(typeVar->getASTContext(), typeVar);
4295
4296
}
4296
4297
4297
4298
// Binding to a pack expansion type is always an error in Swift 6 mode.
You can’t perform that action at this time.
0 commit comments