File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Sources/SwiftFormat/PrettyPrint
Tests/SwiftFormatTests/PrettyPrint Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2511,6 +2511,13 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
2511
2511
return . visitChildren
2512
2512
}
2513
2513
2514
+ override func visit( _ node: CopyExprSyntax ) -> SyntaxVisitorContinueKind {
2515
+ // The `copy` keyword cannot be separated from the following token or it will be parsed as an
2516
+ // identifier.
2517
+ after ( node. copyKeyword, tokens: . space)
2518
+ return . visitChildren
2519
+ }
2520
+
2514
2521
override func visit( _ node: DiscardStmtSyntax ) -> SyntaxVisitorContinueKind {
2515
2522
// The `discard` keyword cannot be separated from the following token or it will be parsed as
2516
2523
// an identifier.
Original file line number Diff line number Diff line change
1
+ final class CopyExprTests : PrettyPrintTestCase {
2
+ func testCopy( ) {
3
+ assertPrettyPrintEqual (
4
+ input: """
5
+ let x = copy y
6
+ """ ,
7
+ expected: """
8
+ let x =
9
+ copy y
10
+
11
+ """ ,
12
+ linelength: 13 )
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments