File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Sources/SwiftFormatPrettyPrint
Tests/SwiftFormatPrettyPrintTests Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1103,7 +1103,8 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
1103
1103
override func visit( _ node: ClosureSignatureSyntax ) -> SyntaxVisitorContinueKind {
1104
1104
before ( node. firstToken, tokens: . open)
1105
1105
1106
- arrangeAttributeList ( node. attributes, suppressFinalBreak: node. input == nil )
1106
+ arrangeAttributeList (
1107
+ node. attributes, suppressFinalBreak: node. input == nil && node. capture == nil )
1107
1108
1108
1109
if let input = node. input {
1109
1110
// We unconditionally put a break before the `in` keyword below, so we should only put a break
Original file line number Diff line number Diff line change @@ -492,6 +492,7 @@ final class ClosureExprTests: PrettyPrintTestCase {
492
492
let b = { @MainActor in print( " hello world " ) }
493
493
let c = { @MainActor param in print( " hi " ) }
494
494
let d = { @MainActor (a: Int) async -> Int in print( " hi " ) }
495
+ let e = { @MainActor [weak self] in print( " hi " ) }
495
496
"""
496
497
497
498
let expected =
@@ -507,6 +508,9 @@ final class ClosureExprTests: PrettyPrintTestCase {
507
508
@MainActor (a: Int) async -> Int in
508
509
print( " hi " )
509
510
}
511
+ let e = { @MainActor [weak self] in
512
+ print( " hi " )
513
+ }
510
514
511
515
"""
512
516
You can’t perform that action at this time.
0 commit comments