Skip to content

Commit 60c11a1

Browse files
committed
Adjust breaking of closure signatures.
1 parent db451bf commit 60c11a1

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ private final class TokenStreamCreator: SyntaxVisitor {
232232
}
233233

234234
override func visit(_ node: ClosureSignatureSyntax) {
235-
before(node.firstToken, tokens: .open(.inconsistent, 2))
235+
before(node.firstToken, tokens: .open(.inconsistent, 0))
236236
after(node.capture?.lastToken, tokens: .break)
237-
after(node.input?.lastToken, tokens: .break)
237+
before(node.input?.firstToken, tokens: .open)
238+
after(node.input?.lastToken, tokens: .close, .break)
238239
after(node.output?.lastToken, tokens: .break)
239240
after(node.throwsTok, tokens: .break)
240241
after(node.lastToken, tokens: .close)

Tests/SwiftFormatPrettyPrintTests/FunctionCallTests.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class FunctionCallTests: PrettyPrintTestCase {
7575
})
7676
funcCall(closure: {
7777
s1, s2, s3, s4, s5, s6, s7, s8, s9, s10
78-
in
78+
in
7979
return s1
8080
})
8181
funcCall(
@@ -189,10 +189,8 @@ public class FunctionCallTests: PrettyPrintTestCase {
189189
return a + 1
190190
}
191191
let b = funcCall() {
192-
[unowned self, weak delegate = self.delegate!] (
193-
a: Int,
194-
b: String
195-
) -> String in
192+
[unowned self, weak delegate = self.delegate!]
193+
(a: Int, b: String) -> String in
196194
return String(a) + b
197195
}
198196

0 commit comments

Comments
 (0)