You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)
Target: x86_64-apple-macosx10.9
Xcode: 9.0 (9A235)
macOS: 10.12.6 (16G29)
Additional Detail from JIRA
Votes
0
Component/s
Compiler, Foundation
Labels
Bug
Assignee
None
Priority
Medium
md5: ec21a6810f42adb139989ac6b511601d
relates to:
SR-5965 Unexpected type-mismatch errors when parsing JSON in Release configuration
Issue Description:
Deserializing an object that has a field of a RawRepresentable type while the rawValue of that type is accessed in a function that is never called fails when whole module optimization is enabled.
As you can see, the neverCalled function is never called from inside the module, nor it is from outside. But moving it into the first file or removing it at all fixes the thing.
If I run the follwing with -O0, it passes. However, when I turn WMO on, it fails.
functestDecode() {
letjson = """ { "Container": { "identifier": "IDENTIFIER", } } """.data(using: .utf8)!
letdecoder = JSONDecoder()
do {
letcontainer = trydecoder.decode([String : Container].self, from: json)["Container"]!
XCTAssertEqual(container, "IDENTIFIER")
} catch {
// This path is executed only when WMO is enabledXCTFail("Couldn't decode:\n\n\(error)\n\n")
}
}
I have created a test project that can be used to reproduce the issue: Codable-WMO-bug
The text was updated successfully, but these errors were encountered:
Environment
Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)
Target: x86_64-apple-macosx10.9
Xcode: 9.0 (9A235)
macOS: 10.12.6 (16G29)
Additional Detail from JIRA
md5: ec21a6810f42adb139989ac6b511601d
relates to:
Issue Description:
Deserializing an object that has a field of a
RawRepresentable
type while therawValue
of that type is accessed in a function that is never called fails when whole module optimization is enabled.I have two files in a module:
As you can see, the
neverCalled
function is never called from inside the module, nor it is from outside. But moving it into the first file or removing it at all fixes the thing.If I run the follwing with
-O0
, it passes. However, when I turn WMO on, it fails.I have created a test project that can be used to reproduce the issue:
Codable-WMO-bug
The text was updated successfully, but these errors were encountered: