Skip to content

Commit 7591cf8

Browse files
authored
Merge pull request #2224 from bnbarham/format-angle-period
Do not add whitespace between right angle and period
2 parents 806c473 + 0978f6b commit 7591cf8

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
@@ -334,6 +334,7 @@ open class BasicFormat: SyntaxRewriter {
334334
(.regexLiteralPattern, _),
335335
(.regexSlash, .regexPoundDelimiter), // closing extended regex delimiter should never be separate by a space
336336
(.rightAngle, .leftParen), // func foo<T>(x: T)
337+
(.rightAngle, .period), // Foo<T>.bar
337338
(.rightBrace, .leftParen), // { return 1 }()
338339
(.rightParen, .leftParen), // returnsClosure()()
339340
(.rightParen, .period), // foo().bar

Tests/SwiftBasicFormatTest/BasicFormatTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,4 +531,11 @@ final class BasicFormatTest: XCTestCase {
531531
)
532532
}
533533
}
534+
535+
func testRightAnglePeriodNotFormatted() {
536+
assertFormatted(
537+
tree: ExprSyntax("Foo<T>.bar"),
538+
expected: "Foo<T>.bar"
539+
)
540+
}
534541
}

0 commit comments

Comments
 (0)