[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

@@ -31,7 +31,7 @@ NSStringTests.test("AnyHashable(NSString) uses Swift String comparison rules") {
let ah2 = AnyHashable(nss2)
expectEqual("String", String(describing: type(of: ah1.base)))
expectEqual("String", String(describing: type(of: ah2.base)))
checkHashable([ah1, ah2], equalityOracle: { _ in true })
checkHashable([ah1, ah2], equalityOracle: { _, _ in true })
}
runAllTests()