File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Sources/SwiftSyntaxMacroExpansion
Tests/SwiftSyntaxMacroExpansionTest Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -399,6 +399,7 @@ private class AttributeRemover: SyntaxRewriter {
399
399
if attributesToRemove. contains ( attribute) {
400
400
var leadingTrivia = attribute. leadingTrivia
401
401
if let lastNewline = leadingTrivia. pieces. lastIndex ( where: \. isNewline) ,
402
+ leadingTrivia. pieces [ lastNewline... ] . allSatisfy ( \. isWhitespace) ,
402
403
attribute. trailingTrivia. isEmpty,
403
404
let nextToken = attribute. nextToken ( viewMode: . sourceAccurate) ,
404
405
!nextToken. leadingTrivia. isEmpty
Original file line number Diff line number Diff line change @@ -196,6 +196,22 @@ final class AttributeRemoverTests: XCTestCase {
196
196
)
197
197
}
198
198
199
+ func testAttributeNewlineBlockCommentEmpty( ) {
200
+ assertMacroExpansion (
201
+ """
202
+ @State
203
+ /*doc comment*/@Test
204
+ var x: Int
205
+ """ ,
206
+ expandedSource: """
207
+ @State
208
+ /*doc comment*/
209
+ var x: Int
210
+ """ ,
211
+ macros: [ " Test " : NoOpPeerMacro . self]
212
+ )
213
+ }
214
+
199
215
func testEmptyBlockCommentEmpty( ) {
200
216
assertMacroExpansion (
201
217
"""
You can’t perform that action at this time.
0 commit comments