File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Sources/SwiftSyntaxMacroExpansion
Tests/SwiftSyntaxMacroExpansionTest Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -530,7 +530,11 @@ public class AttributeRemover: SyntaxRewriter {
530
530
531
531
public override func visit( _ node: AttributeListSyntax ) -> AttributeListSyntax {
532
532
var filteredAttributes : [ AttributeListSyntax . Element ] = [ ]
533
- for case . attribute( let attribute) in node {
533
+ for attribute in node {
534
+ guard case . attribute( let attribute) = attribute else {
535
+ filteredAttributes. append ( attribute)
536
+ continue
537
+ }
534
538
if self . predicate ( attribute) {
535
539
var leadingTrivia = attribute. leadingTrivia
536
540
Original file line number Diff line number Diff line change @@ -470,4 +470,21 @@ final class AttributeRemoverTests: XCTestCase {
470
470
"""
471
471
)
472
472
}
473
+
474
+ func testKeepPoundIfInAttributes( ) {
475
+ assertSyntaxRemovingTestAttributes (
476
+ """
477
+ #if true
478
+ @inlinable
479
+ #endif
480
+ func f() {}
481
+ """ ,
482
+ reduction: """
483
+ #if true
484
+ @inlinable
485
+ #endif
486
+ func f() {}
487
+ """
488
+ )
489
+ }
473
490
}
You can’t perform that action at this time.
0 commit comments