Skip to content

Commit 40e084e

Browse files
committed
Fix passing of structurable tuple to single Any param.
1 parent 700bb5e commit 40e084e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ matchCallArguments(ConstraintSystem &cs, TypeMatchKind kind,
516516
// If the param type is an empty existential composition, the function can
517517
// only have one argument. Check if exactly one argument was passed to this
518518
// function, otherwise we obviously have a mismatch
519-
if (auto tupleArgType = argType->getAs<TupleType>()) {
519+
if (auto tupleArgType = dyn_cast<TupleType>(argType.getPointer())) {
520520
if (tupleArgType->getNumElements() != 1) {
521521
return ConstraintSystem::SolutionKind::Error;
522522
}

test/Constraints/function.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ print(r22451001(5)) // expected-error {{argument passed to call that takes no a
8080
func sr590(x: Any) {}
8181
sr590(3,4) // expected-error {{extra argument in call}}
8282
sr590() // expected-error {{missing argument for parameter #1 in call}}
83+
// Make sure calling with structural tuples still works.
84+
sr590(())
85+
sr590((1, 2))

0 commit comments

Comments
 (0)