Skip to content

Commit 3c055c9

Browse files
authored
Merge pull request #130 from dylansturg/weird_array_elements
Swap order of .close and .break around tuple exprs.
2 parents e0a13b1 + 8fcddf2 commit 3c055c9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ private final class TokenStreamCreator: SyntaxVisitor {
656656
} else if elementCount > 1 {
657657
// Tuples with more than one element are "true" tuples, and should indent as block structures.
658658
after(node.leftParen, tokens: .break(.open, size: 0), .open)
659-
before(node.rightParen, tokens: .close, .break(.close, size: 0))
659+
before(node.rightParen, tokens: .break(.close, size: 0), .close)
660660

661661
insertTokens(.break(.same), betweenElementsOf: node.elementList)
662662

Tests/SwiftFormatPrettyPrintTests/TupleDeclTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public class TupleDeclTests: PrettyPrintTestCase {
44
"""
55
let a = (1, 2, 3)
66
let a: (Int, Int, Int) = (1, 2, 3)
7+
let a = (1, 2, 3, 4, 5, 6, 70, 80, 90)
78
let a = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
89
let a = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
910
"""
@@ -12,6 +13,9 @@ public class TupleDeclTests: PrettyPrintTestCase {
1213
"""
1314
let a = (1, 2, 3)
1415
let a: (Int, Int, Int) = (1, 2, 3)
16+
let a = (
17+
1, 2, 3, 4, 5, 6, 70, 80, 90
18+
)
1519
let a = (
1620
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
1721
)

0 commit comments

Comments
 (0)