From d022b8b9596f1456ea485c32b49c425905010813 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 13 Nov 2025 07:20:14 +1000 Subject: [PATCH] Remove added group around base type in `AttributedTypeSyntax` Causes quite a few changes in eg. sourcekit-lsp, so presumably will in other codebases as well. Ideally we'd add this behind some new versioning in the config. As an example of a change this causes: ``` private let logMessageToIndexLog: @Sendable ( _ message: String, _ type: WindowMessageType, _ structure: LanguageServerProtocol.StructuredLogKind ) -> Void ``` To: ``` @Sendable ( _ message: String, _ type: WindowMessageType, _ structure: LanguageServerProtocol.StructuredLogKind ) -> Void ``` --- .../SwiftFormat/PrettyPrint/TokenStreamCreator.swift | 3 --- .../PrettyPrint/FunctionTypeTests.swift | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift b/Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift index 46a805a2..f56f50e6 100644 --- a/Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift +++ b/Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift @@ -2411,9 +2411,6 @@ private final class TokenStreamCreator: SyntaxVisitor { ) } - before(node.baseType.firstToken(viewMode: .sourceAccurate), tokens: .open) - after(node.baseType.lastToken(viewMode: .sourceAccurate), tokens: .close) - after(node.lastToken(viewMode: .sourceAccurate), tokens: .close) return .visitChildren } diff --git a/Tests/SwiftFormatTests/PrettyPrint/FunctionTypeTests.swift b/Tests/SwiftFormatTests/PrettyPrint/FunctionTypeTests.swift index 2bb5b326..d7b7f30c 100644 --- a/Tests/SwiftFormatTests/PrettyPrint/FunctionTypeTests.swift +++ b/Tests/SwiftFormatTests/PrettyPrint/FunctionTypeTests.swift @@ -316,15 +316,15 @@ final class FunctionTypeTests: PrettyPrintTestCase { expected: """ func f( _ body: - nonisolated(nonsending) - () async -> Void + nonisolated(nonsending) () + async -> Void ) {} func f( _ body: @Foo @Bar - nonisolated(nonsending) - () async -> Void + nonisolated(nonsending) () + async -> Void ) {} func f( @@ -336,8 +336,8 @@ final class FunctionTypeTests: PrettyPrintTestCase { func f( _ body: inout @Foo @Bar - nonisolated(nonsending) - () async -> Void + nonisolated(nonsending) () + async -> Void ) {} """,