@@ -983,22 +983,24 @@ ConstraintSystem::TypeMatchResult constraints::matchCallArguments(
983
983
parameterBindings, locator);
984
984
if (constraints::matchCallArguments (
985
985
argsWithLabels, params, paramInfo, hasTrailingClosure,
986
- cs.shouldAttemptFixes (), listener, parameterBindings)) {
987
- if (!cs.shouldAttemptFixes ())
988
- return cs.getTypeMatchFailure (locator);
989
-
990
- if (AllowTupleSplatForSingleParameter::attempt (
991
- cs, argsWithLabels, params, parameterBindings, locator))
992
- return cs.getTypeMatchFailure (locator);
993
- }
986
+ cs.shouldAttemptFixes (), listener, parameterBindings))
987
+ return cs.getTypeMatchFailure (locator);
994
988
995
989
auto extraArguments = listener.getExtraneousArguments ();
996
990
if (!extraArguments.empty ()) {
997
- auto *fix = RemoveExtraneousArguments::create (
998
- cs, contextualType, extraArguments, cs.getConstraintLocator (locator));
999
-
1000
- if (cs.recordFix (fix, /* impact=*/ extraArguments.size () * 2 ))
1001
- return cs.getTypeMatchFailure (locator);
991
+ // First let's see whether this is a situation where a single
992
+ // parameter is a tuple, but N distinct arguments were passed in.
993
+ if (AllowTupleSplatForSingleParameter::attempt (
994
+ cs, argsWithLabels, params, parameterBindings, locator)) {
995
+ // Let's produce a generic "extraneous arguments"
996
+ // diagnostic otherwise.
997
+ auto *fix = RemoveExtraneousArguments::create (
998
+ cs, contextualType, extraArguments,
999
+ cs.getConstraintLocator (locator));
1000
+
1001
+ if (cs.recordFix (fix, /* impact=*/ extraArguments.size () * 5 ))
1002
+ return cs.getTypeMatchFailure (locator);
1003
+ }
1002
1004
}
1003
1005
}
1004
1006
0 commit comments