File tree Expand file tree Collapse file tree 2 files changed +5
-13
lines changed
Sources/SwiftFormatPrettyPrint
Tests/SwiftFormatPrettyPrintTests Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -764,7 +764,9 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
764
764
}
765
765
766
766
override func visit( _ node: YieldStmtSyntax ) -> SyntaxVisitorContinueKind {
767
- after ( node. yieldKeyword, tokens: . break)
767
+ // As of https://github.com/apple/swift-syntax/pull/895, the token following a `yield` keyword
768
+ // *must* be on the same line, so we cannot break here.
769
+ after ( node. yieldKeyword, tokens: . space)
768
770
return . visitChildren
769
771
}
770
772
@@ -1641,10 +1643,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
1641
1643
return . visitChildren
1642
1644
}
1643
1645
1644
- override func visit( _ node: ElseBlockSyntax ) -> SyntaxVisitorContinueKind {
1645
- return . visitChildren
1646
- }
1647
-
1648
1646
override func visit( _ node: ConditionElementSyntax ) -> SyntaxVisitorContinueKind {
1649
1647
before ( node. firstToken, tokens: . open)
1650
1648
if let comma = node. trailingComma {
@@ -2178,10 +2176,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
2178
2176
return . visitChildren
2179
2177
}
2180
2178
2181
- override func visit( _ node: ElseIfContinuationSyntax ) -> SyntaxVisitorContinueKind {
2182
- return . visitChildren
2183
- }
2184
-
2185
2179
override func visit( _ node: GenericWhereClauseSyntax ) -> SyntaxVisitorContinueKind {
2186
2180
guard node. whereKeyword != node. lastToken else {
2187
2181
verbatimToken ( Syntax ( node) )
Original file line number Diff line number Diff line change @@ -17,14 +17,12 @@ final class YieldStmtTests: PrettyPrintTestCase {
17
17
"""
18
18
var foo: Int {
19
19
_read {
20
- yield
21
- 1234567890
20
+ yield 1234567890
22
21
}
23
22
_modify {
24
23
var someLongVariable =
25
24
0
26
- yield
27
- &someLongVariable
25
+ yield &someLongVariable
28
26
}
29
27
}
30
28
You can’t perform that action at this time.
0 commit comments