[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:
Daniel Duan
2016-07-31 01:30:51 -07:00
parent d3194ecbe4
commit c9b73dacc2
36 changed files with 70 additions and 77 deletions

View File

@@ -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])