Skip to content

Commit 5bb28eb

Browse files
bnbarhamahoppen
authored andcommitted
Do not add whitespace between right angle and period
`Foo<T>.bar` should not have whitespace added between `>` and `.`.
1 parent 7420304 commit 5bb28eb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Sources/SwiftBasicFormat/BasicFormat.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ open class BasicFormat: SyntaxRewriter {
310310
(.regexLiteralPattern, _),
311311
(.regexSlash, .regexPoundDelimiter), // closing extended regex delimiter should never be separate by a space
312312
(.rightAngle, .leftParen), // func foo<T>(x: T)
313+
(.rightAngle, .period), // Foo<T>.bar
313314
(.rightBrace, .leftParen), // { return 1 }()
314315
(.rightParen, .leftParen), // returnsClosure()()
315316
(.rightParen, .period), // foo().bar

Tests/SwiftBasicFormatTest/BasicFormatTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,4 +504,11 @@ final class BasicFormatTest: XCTestCase {
504504
)
505505
}
506506
}
507+
508+
func testRightAnglePeriodNotFormatted() {
509+
assertFormatted(
510+
tree: ExprSyntax("Foo<T>.bar"),
511+
expected: "Foo<T>.bar"
512+
)
513+
}
507514
}

0 commit comments

Comments
 (0)