diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 4f4cffcf854f3..a1f64680131ba 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -2747,6 +2747,12 @@ static bool fixMissingArguments(ConstraintSystem &cs, ASTNode anchor, args.pop_back(); for (const auto &elt : tuple->getElements()) args.emplace_back(elt.getType(), elt.getName()); + + // If unpacking a tuple results in more arguments than parameters + // it would be diagnosed as a general mismatch because it's unclear + // whether it's a problem with missing or extraneous parameters. + if (args.size() > params.size()) + return true; } else if (auto *typeVar = argType->getAs()) { auto isParam = [](const Expr *expr) { if (auto *DRE = dyn_cast(expr)) { diff --git a/validation-test/compiler_crashers/fixMissingArguments-ef29fe.swift b/validation-test/compiler_crashers_fixed/fixMissingArguments-ef29fe.swift similarity index 85% rename from validation-test/compiler_crashers/fixMissingArguments-ef29fe.swift rename to validation-test/compiler_crashers_fixed/fixMissingArguments-ef29fe.swift index 17033d595e488..07a7e52b86f9c 100644 --- a/validation-test/compiler_crashers/fixMissingArguments-ef29fe.swift +++ b/validation-test/compiler_crashers_fixed/fixMissingArguments-ef29fe.swift @@ -1,4 +1,4 @@ // {"kind":"typecheck","languageMode":6,"signature":"fixMissingArguments(swift::constraints::ConstraintSystem&, swift::ASTNode, llvm::SmallVectorImpl&, llvm::ArrayRef, unsigned int, swift::constraints::ConstraintLocatorBuilder)","signatureAssert":"Assertion failed: (Index < Length && \"Invalid index!\"), function operator[]"} -// RUN: not --crash %target-swift-frontend -typecheck -swift-version 6 %s +// RUN: not %target-swift-frontend -typecheck -swift-version 6 %s func a((Int, Int, Int)) a > { b, c in