@@ -7282,22 +7282,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7282
7282
}
7283
7283
}
7284
7284
7285
- // Matching types where one side is a pack expansion and the other is not
7286
- // means a pack expansion was used where it isn't supported.
7287
- if (type1->is<PackExpansionType>() != type2->is<PackExpansionType>()) {
7288
- if (!shouldAttemptFixes())
7289
- return getTypeMatchFailure(locator);
7290
-
7291
- if (type1->isPlaceholder() || type2->isPlaceholder())
7292
- return getTypeMatchSuccess();
7293
-
7294
- auto *loc = getConstraintLocator(locator);
7295
- if (recordFix(AllowInvalidPackExpansion::create(*this, loc)))
7296
- return getTypeMatchFailure(locator);
7297
-
7298
- return getTypeMatchSuccess();
7299
- }
7300
-
7301
7285
if (kind >= ConstraintKind::Conversion) {
7302
7286
// An lvalue of type T1 can be converted to a value of type T2 so long as
7303
7287
// T1 is convertible to T2 (by loading the value). Note that we cannot get
@@ -7720,6 +7704,22 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7720
7704
}
7721
7705
}
7722
7706
7707
+ // Matching types where one side is a pack expansion and the other is not
7708
+ // means a pack expansion was used where it isn't supported.
7709
+ if (type1->is<PackExpansionType>() != type2->is<PackExpansionType>()) {
7710
+ if (!shouldAttemptFixes())
7711
+ return getTypeMatchFailure(locator);
7712
+
7713
+ if (type1->isPlaceholder() || type2->isPlaceholder())
7714
+ return getTypeMatchSuccess();
7715
+
7716
+ auto *loc = getConstraintLocator(locator);
7717
+ if (recordFix(AllowInvalidPackExpansion::create(*this, loc)))
7718
+ return getTypeMatchFailure(locator);
7719
+
7720
+ return getTypeMatchSuccess();
7721
+ }
7722
+
7723
7723
// Attempt fixes iff it's allowed, both types are concrete and
7724
7724
// we are not in the middle of attempting one already.
7725
7725
if (shouldAttemptFixes() && !flags.contains(TMF_ApplyingFix)) {
0 commit comments