blob: 780cff657d2d29a092130a00af6e0d7246149ca6 [file] [log] [blame]
struct Foo {
static func foo(a: () -> Int) {}
func qux(x: Int, y: () -> Int ) {}
}
func testTrailingClosure() -> String {
Foo.foo(a: { 1 })
Foo.bar { print(3); return 1 }
Foo().qux(x: 1, y: { 1 })
let _ = Foo().quux(x: 1, y: { 1 })
[1,2,3]
.filter({ $0 % 2 == 0 })
.map({ $0 + 1 })
}
func foobar(first: String? = nil, closure: () -> Void) { fatalError() }
func blah() {
_ = foobar(closure: { print("foo") })
}