mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fixes crash in "Convert To Trailing Closure" action if call has defaulted parameters. Handle `TupleShuffleExpr` properly. rdar://problem/41093898
26 lines
442 B
Plaintext
26 lines
442 B
Plaintext
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") })
|
|
}
|
|
|
|
|
|
|
|
|
|
|