@@ -1068,6 +1068,8 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
1068
1068
override func visit( _ node: ClosureSignatureSyntax ) -> SyntaxVisitorContinueKind {
1069
1069
before ( node. firstToken, tokens: . open)
1070
1070
1071
+ arrangeAttributeList ( node. attributes, suppressFinalBreak: node. input == nil )
1072
+
1071
1073
if let input = node. input {
1072
1074
// We unconditionally put a break before the `in` keyword below, so we should only put a break
1073
1075
// after the capture list's right bracket if there are arguments following it or we'll end up
@@ -2531,11 +2533,18 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
2531
2533
// MARK: - Various other helper methods
2532
2534
2533
2535
/// Applies formatting tokens around and between the attributes in an attribute list.
2534
- private func arrangeAttributeList( _ attributes: AttributeListSyntax ? ) {
2536
+ private func arrangeAttributeList(
2537
+ _ attributes: AttributeListSyntax ? ,
2538
+ suppressFinalBreak: Bool = false
2539
+ ) {
2535
2540
if let attributes = attributes {
2536
2541
before ( attributes. firstToken, tokens: . open)
2537
2542
insertTokens ( . break( . same) , betweenElementsOf: attributes)
2538
- after ( attributes. lastToken, tokens: . close, . break( . same) )
2543
+ var afterAttributeTokens = [ Token . close]
2544
+ if !suppressFinalBreak {
2545
+ afterAttributeTokens. append ( . break( . same) )
2546
+ }
2547
+ after ( attributes. lastToken, tokens: afterAttributeTokens)
2539
2548
}
2540
2549
}
2541
2550
0 commit comments