Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TypeVariableType>()) {
auto isParam = [](const Expr *expr) {
if (auto *DRE = dyn_cast<DeclRefExpr>(expr)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// {"kind":"typecheck","languageMode":6,"signature":"fixMissingArguments(swift::constraints::ConstraintSystem&, swift::ASTNode, llvm::SmallVectorImpl<swift::AnyFunctionType::Param>&, llvm::ArrayRef<swift::AnyFunctionType::Param>, 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