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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user