Skip to content

Commit 3b1dcc9

Browse files
committed
Merge remote-tracking branch 'upstream/main' into wasm32-wasi
2 parents 5f65c9e + bc7c751 commit 3b1dcc9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift

+1
Original file line numberDiff line numberDiff line change
@@ -3903,6 +3903,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
39033903
before(clause.poundKeyword, tokens: .break(.contextual, size: 0))
39043904
}
39053905
before(postfixIfExpr.config.poundEndif, tokens: .break(.contextual, size: 0))
3906+
after(postfixIfExpr.config.poundEndif, tokens: .break(.same, size: 0))
39063907

39073908
return insertContextualBreaks(base, isTopLevel: false)
39083909
} else if let callingExpr = expr.asProtocol(CallingExprSyntaxProtocol.self) {

Tests/SwiftFormatTests/PrettyPrint/IfConfigTests.swift

+15
Original file line numberDiff line numberDiff line change
@@ -516,4 +516,19 @@ final class IfConfigTests: PrettyPrintTestCase {
516516

517517
assertPrettyPrintEqual(input: input, expected: expected, linelength: 45)
518518
}
519+
520+
func testPostfixPoundIfInParameterList() {
521+
let input =
522+
"""
523+
print(
524+
32
525+
#if true
526+
.foo
527+
#endif
528+
, 22
529+
)
530+
531+
"""
532+
assertPrettyPrintEqual(input: input, expected: input, linelength: 45)
533+
}
519534
}

0 commit comments

Comments
 (0)