Skip to content

Commit 6b125d9

Browse files
authored
Merge pull request #1400 from DougGregor/one-vertical-pipe-to-rule-them-all
2 parents f92f133 + 841a9fb commit 6b125d9

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

Sources/SwiftDiagnostics/DiagnosticsFormatter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public struct DiagnosticsFormatter {
286286

287287
for (column, diags) in diagsPerColumn {
288288
// compute the string that is shown before each message
289-
var preMessage = indentString + String(repeating: " ", count: maxNumberOfDigits) + " " + colorizeBufferOutline("")
289+
var preMessage = indentString + String(repeating: " ", count: maxNumberOfDigits) + " " + colorizeBufferOutline("")
290290
for c in 0..<column {
291291
if columnsWithDiagnostics.contains(c) {
292292
preMessage.append("")

Tests/SwiftDiagnosticsTest/DiagnosticsFormatterTests.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class DiagnosticsFormatterTests: XCTestCase {
3030
"""
3131
let expectedOutput = """
3232
1 │ var foo = bar +
33-
╰─ error: expected expression after operator
33+
╰─ error: expected expression after operator
3434
3535
"""
3636
AssertStringsEqualWithDiff(annotate(source: source), expectedOutput)
@@ -42,9 +42,9 @@ final class DiagnosticsFormatterTests: XCTestCase {
4242
"""
4343
let expectedOutput = """
4444
1 │ foo.[].[].[]
45-
│ │ ╰─ error: expected name in member access
46-
│ ╰─ error: expected name in member access
47-
╰─ error: expected name in member access
45+
│ │ ╰─ error: expected name in member access
46+
│ ╰─ error: expected name in member access
47+
╰─ error: expected name in member access
4848
4949
"""
5050
AssertStringsEqualWithDiff(annotate(source: source), expectedOutput)
@@ -68,14 +68,14 @@ final class DiagnosticsFormatterTests: XCTestCase {
6868
2 │ i = 2
6969
3 │ i = foo(
7070
4 │ i = 4
71-
╰─ error: expected ')' to end function call
71+
╰─ error: expected ')' to end function call
7272
5 │ i = 5
7373
6 │ i = 6
7474
7575
9 │ i = 9
7676
10 │ i = 10
7777
11 │ i = bar(
78-
╰─ error: expected value and ')' to end function call
78+
╰─ error: expected value and ')' to end function call
7979
8080
"""
8181
AssertStringsEqualWithDiff(annotate(source: source), expectedOutput)
@@ -86,8 +86,8 @@ final class DiagnosticsFormatterTests: XCTestCase {
8686

8787
let expectedOutput = """
8888
1 │ t as (..)
89-
├─ error: expected type in tuple type
90-
╰─ error: unexpected code '..' in tuple type
89+
├─ error: expected type in tuple type
90+
╰─ error: unexpected code '..' in tuple type
9191
9292
"""
9393

@@ -101,7 +101,7 @@ final class DiagnosticsFormatterTests: XCTestCase {
101101

102102
let expectedOutput = """
103103
\u{001B}[0;36m1 │\u{001B}[0;0m var foo = bar +
104-
\u{001B}[0;36m\u{001B}[0;0m ╰─ \u{001B}[1;31merror: expected expression after operator\u{001B}[0;0m
104+
\u{001B}[0;36m\u{001B}[0;0m ╰─ \u{001B}[1;31merror: expected expression after operator\u{001B}[0;0m
105105
106106
"""
107107
AssertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput)
@@ -113,9 +113,9 @@ final class DiagnosticsFormatterTests: XCTestCase {
113113
"""
114114
let expectedOutput = """
115115
\u{001B}[0;36m1 │\u{001B}[0;0m foo.[].[].[]
116-
\u{001B}[0;36m\u{001B}[0;0m │ │ ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m
117-
\u{001B}[0;36m\u{001B}[0;0m │ ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m
118-
\u{001B}[0;36m\u{001B}[0;0m ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m
116+
\u{001B}[0;36m\u{001B}[0;0m │ │ ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m
117+
\u{001B}[0;36m\u{001B}[0;0m │ ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m
118+
\u{001B}[0;36m\u{001B}[0;0m ╰─ \u{001B}[1;31merror: expected name in member access\u{001B}[0;0m
119119
120120
"""
121121
AssertStringsEqualWithDiff(annotate(source: source, colorize: true), expectedOutput)
@@ -128,8 +128,8 @@ final class DiagnosticsFormatterTests: XCTestCase {
128128

129129
let expectedOutput = """
130130
\u{001B}[0;36m1 │\u{001B}[0;0m for \u{001B}[4;39m(i\u{001B}[0;0m \u{001B}[4;39m= 🐮; i != 👩‍👩‍👦‍👦; i += 1)\u{001B}[0;0m { }
131-
\u{001B}[0;36m\u{001B}[0;0m │ ╰─ \u{001B}[1;31merror: expected ')' to end tuple pattern\u{001B}[0;0m
132-
\u{001B}[0;36m\u{001B}[0;0m ╰─ \u{001B}[1;31merror: C-style for statement has been removed in Swift 3\u{001B}[0;0m
131+
\u{001B}[0;36m\u{001B}[0;0m │ ╰─ \u{001B}[1;31merror: expected ')' to end tuple pattern\u{001B}[0;0m
132+
\u{001B}[0;36m\u{001B}[0;0m ╰─ \u{001B}[1;31merror: C-style for statement has been removed in Swift 3\u{001B}[0;0m
133133
134134
"""
135135

Tests/SwiftDiagnosticsTest/GroupDiagnosticsFormatterTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,17 @@ final class GroupedDiagnosticsFormatterTests: XCTestCase {
114114
=== main.swift ===
115115
1 │ let pi = 3.14159
116116
2 │ #myAssert(pi == 3)
117-
╰─ note: in expansion of macro 'myAssert' here
117+
╰─ note: in expansion of macro 'myAssert' here
118118
╭─── #myAssert ───────────────────────────────────────────────────────
119119
│1 │ let __a = pi
120120
│2 │ let __b = 3
121121
│3 │ if !(__a == __b) {
122-
╰─ error: no matching operator '==' for types 'Double' and 'Int'
122+
╰─ error: no matching operator '==' for types 'Double' and 'Int'
123123
│4 │ fatalError("assertion failed: pi != 3")
124124
│5 │ }
125125
╰─────────────────────────────────────────────────────────────────────
126126
3 │ print("hello"
127-
╰─ error: expected ')' to end function call
127+
╰─ error: expected ')' to end function call
128128
129129
"""
130130
)
@@ -183,21 +183,21 @@ final class GroupedDiagnosticsFormatterTests: XCTestCase {
183183
=== main.swift ===
184184
1 │ let pi = 3.14159
185185
2 │ #myAssert(pi == 3)
186-
╰─ note: in expansion of macro 'myAssert' here
186+
╰─ note: in expansion of macro 'myAssert' here
187187
╭─── #myAssert ───────────────────────────────────────────────────────
188188
│1 │ let __a = pi
189189
│2 │ let __b = 3
190190
│3 │ if #invertedEqualityCheck(__a, __b) {
191-
╰─ note: in expansion of macro 'invertedEqualityCheck' here
191+
╰─ note: in expansion of macro 'invertedEqualityCheck' here
192192
│ ╭─── #invertedEqualityCheck ───────────────────────────────────────
193193
│ │1 │ !(__a == __b)
194-
│ │ ╰─ error: no matching operator '==' for types 'Double' and 'Int'
194+
│ │ ╰─ error: no matching operator '==' for types 'Double' and 'Int'
195195
│ ╰──────────────────────────────────────────────────────────────────
196196
│4 │ fatalError("assertion failed: pi != 3")
197197
│5 │ }
198198
╰─────────────────────────────────────────────────────────────────────
199199
3 │ print("hello"
200-
╰─ error: expected ')' to end function call
200+
╰─ error: expected ')' to end function call
201201
202202
"""
203203
)

Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ final class StringInterpolationTests: XCTestCase {
418418
"""
419419
420420
1 │ /*comment*/ invalid /*comm*/
421-
╰─ error: unexpected trivia 'invalid'
421+
╰─ error: unexpected trivia 'invalid'
422422
423423
"""
424424
)
@@ -435,8 +435,8 @@ final class StringInterpolationTests: XCTestCase {
435435
"""
436436
437437
1 │ return 1
438-
│ ╰─ error: expected declaration
439-
╰─ error: unexpected code 'return 1' before declaration
438+
│ ╰─ error: expected declaration
439+
╰─ error: unexpected code 'return 1' before declaration
440440
441441
"""
442442
)
@@ -453,8 +453,8 @@ final class StringInterpolationTests: XCTestCase {
453453
"""
454454
455455
1 │ struct Foo {}
456-
│ ╰─ error: expected statement
457-
╰─ error: unexpected code 'struct Foo {}' before statement
456+
│ ╰─ error: expected statement
457+
╰─ error: unexpected code 'struct Foo {}' before statement
458458
459459
"""
460460
)

0 commit comments

Comments
 (0)