From 7fcfdea68c2238438ebd9922f06c42021ef71298 Mon Sep 17 00:00:00 2001 From: Mihaela Mihaljevic Date: Sat, 18 Jul 2026 23:54:27 +0200 Subject: [PATCH] fix(tests): read fixtures via contentsOfFile:, not String(contentsOf:) String(contentsOf: url, encoding:) itself was the failure, independent of how url was obtained -- a bare `for url in urls` with no sort at all reproduces the same NSURL/URL error on this toolchain. This is a documented swift-corelibs-foundation issue (SR-7620): String(contentsOf:) has inconsistent NSURL/URL bridging on Linux. contentsOfFile: takes a String path instead of a URL, so it has no exposure to that bridging ambiguity at all. Verified via a full clean macOS build and the specific test passing, plus swiftformat/swiftlint --strict clean; the Linux relay confirms or refutes the actual claim on the next push. --- Tests/TaggedNodeCorpusRoundTripTests.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tests/TaggedNodeCorpusRoundTripTests.swift b/Tests/TaggedNodeCorpusRoundTripTests.swift index 4aca297..0235e63 100644 --- a/Tests/TaggedNodeCorpusRoundTripTests.swift +++ b/Tests/TaggedNodeCorpusRoundTripTests.swift @@ -31,7 +31,13 @@ struct TaggedNodeCorpusRoundTripTests { let order = names.indices.sorted { names[$0] < names[$1] } for index in order { let url = urls[index] - let source = try String(contentsOf: url, encoding: .utf8) + // `String(contentsOf: url, encoding:)` itself hit the same NSURL/URL confusion on + // this toolchain regardless of how `url` was obtained (a bare `for url in urls` with + // no sort at all reproduces it too). `contentsOfFile:` takes a `String` path -- a + // type this toolchain's Foundation does not have two conflicting URL/NSURL overloads + // for -- sidestepping the ambiguity at its actual point of failure instead of + // upstream of it. + let source = try String(contentsOfFile: url.path, encoding: .utf8) let parsed: PureYAML.Tagged.Node do { parsed = try PureYAML.parseTagged(source)