Skip to content

Commit 9c4d6f4

Browse files
authored
Revert "[SwiftSyntax] Add debug print when the JSONDecoder fails to decode JSON (#14056)" (#14101)
This reverts commit 840166c.
1 parent f0e906c commit 9c4d6f4

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

test/SwiftSyntax/VisitorTest.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// REQUIRES: OS=macosx
44
// REQUIRES: objc_interop
55

6+
// FIXME: This test fails occassionally in CI with invalid json.
7+
// REQUIRES: disabled
8+
69
import StdlibUnittest
710
import Foundation
811
import SwiftSyntax
@@ -35,4 +38,4 @@ VisitorTests.test("Basic") {
3538
})
3639
}
3740

38-
runAllTests()
41+
runAllTests()

tools/SwiftSyntax/SwiftSyntax.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import Glibc
2525
public enum ParserError: Error {
2626
case swiftcFailed(Int, String)
2727
case invalidFile
28-
case jsonDecodeError(input: String, originalError: Error);
2928
}
3029

3130
extension Syntax {
@@ -43,16 +42,8 @@ extension Syntax {
4342
guard result.wasSuccessful else {
4443
throw ParserError.swiftcFailed(result.exitCode, result.stderr)
4544
}
46-
let jsonData = result.stdoutData
4745
let decoder = JSONDecoder()
48-
let raw: RawSyntax
49-
do {
50-
raw = try decoder.decode(RawSyntax.self, from: jsonData)
51-
} catch let err {
52-
throw ParserError.jsonDecodeError(
53-
input: String(data: jsonData, encoding: .utf8) ?? jsonData.base64EncodedString(),
54-
originalError: err)
55-
}
46+
let raw = try decoder.decode(RawSyntax.self, from: result.stdoutData)
5647
guard let file = Syntax.fromRaw(raw) as? SourceFileSyntax else {
5748
throw ParserError.invalidFile
5849
}

0 commit comments

Comments
 (0)