mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If a tuple is passed as the only argument to a function that takes two unnamed arguments, we try to diagnose the missing argument label. However, in the old diagnose code we didn’t distinguish between non-existing arguments and arguments without labels; both behaved the same. Thus, the missing second argument in the function call would line up with the empty second argument label, not producing a diagnostic, but hitting an assertion later on. Distinguish between the two to fix the issue. Fixes rdar://64319340
12 lines
441 B
Swift
12 lines
441 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
func twoArgs(_ a: Int, _ b: Int) -> Void { //expected-note{{'twoArgs' declared here}}
|
|
}
|
|
|
|
func call() {
|
|
// Call a function that takes two unnamed arguments with a tuple that has two
|
|
// named arguments
|
|
let namedTuple: (x: Int, y: Int) = (1, 1)
|
|
twoArgs(namedTuple) // expected-error{{global function 'twoArgs' expects 2 separate arguments}} expected-error{{missing argument label ':' in call}}
|
|
}
|