mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Since we no longer allow constraction of subtype constraints, workaround which exists in `matchTypes`, for situations where left-hand side of such constraint is going to be wrapped in `inout` type, is no longer required. Resolves: rdar://problem/34137342, rdar://problem/34136625
21 lines
618 B
Swift
21 lines
618 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 3
|
|
|
|
var _: () -> Int = {a in 0}
|
|
|
|
var _: (Int, Int) -> Int = {a in 0}
|
|
|
|
// <rdar://problem/20371273> Type errors inside anonymous functions don't provide enough information
|
|
func f20371273() {
|
|
let x: [Int] = [1, 2, 3, 4]
|
|
let y: UInt = 4
|
|
_ = x.filter { ($0 + y) > 42 } // expected-warning {{deprecated}}
|
|
}
|
|
|
|
// rdar://problem/32432145 - compiler should emit fixit to remove "_ in" in closures if 0 parameters is expected
|
|
|
|
func r32432145(_ a: () -> ()) {}
|
|
r32432145 { _ in let _ = 42 } // Ok in Swift 3
|
|
r32432145 { _ in // Ok in Swift 3
|
|
print("answer is 42")
|
|
}
|