Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/TSCUtility/SerializedDiagnostics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ extension SerializedDiagnostics {
}

case .version, nil:
throw Error.unexpectedRecord
// Ignore unknown records, for future compatibility
continue
}
}

Expand Down
Binary file not shown.
10 changes: 10 additions & 0 deletions Tests/TSCUtilityTests/SerializedDiagnosticsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ final class SerializedDiagnosticsTests: XCTestCase {
XCTAssertEqual(diag.fixIts.count, 0)
}

func testReadDiagsWithUnknownRecord() throws {
let serializedDiagnosticsPath = AbsolutePath(path: #file).parentDirectory
.appending(components: "Inputs", "string_init_ambig.dia")
let contents = try localFileSystem.readFileContents(serializedDiagnosticsPath)
let serializedDiags = try SerializedDiagnostics(bytes: contents)

XCTAssertEqual(serializedDiags.versionNumber, 2)
XCTAssertEqual(serializedDiags.diagnostics.count, 35)
}

func testReadClangSerializedDiags() throws {
let serializedDiagnosticsPath = AbsolutePath(path: #file).parentDirectory
.appending(components: "Inputs", "clang.dia")
Expand Down