mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] ban multi-arguments to tuple coercion
Implements part of SE-0110. Single argument in closures will not be accepted if
there exists explicit type with a number of arguments that's not 1.
```swift
let f: (Int, Int) -> Void = { x in } // this is now an error
```
Note there's a second part of SE-0110 which could be considered additive,
which says one must add an extra pair of parens to specify a single arugment
type that is a tuple:
```swift
let g ((Int, Int)) -> Void = { y in } // y should have type (Int, Int)
```
This patch does not implement that part.
This commit is contained in:
@@ -182,7 +182,7 @@ func testNSNumberGetValueAndObjCType(
|
||||
n.getValue(&a)
|
||||
n.getValue(&b)
|
||||
let ab = Array(zip(a, b))
|
||||
let count = ab.index { $0.0 == 0xaa && $0.1 == 0xbb }!
|
||||
let count = ab.index { $0 == 0xaa && $1 == 0xbb }!
|
||||
// Check that `getValue` does not overwrite more bytes than needed.
|
||||
expectEqual(expectedBytes.count, count)
|
||||
expectEqualSequence(expectedBytes, a[0..<count])
|
||||
|
||||
Reference in New Issue
Block a user