Open swift-ci opened 6 years ago
I can't reproduce this with the following code:
struct GenericID<T>: RawRepresentable, Hashable, Codable {
let rawValue: Int
init(rawValue: Int) { self.rawValue = rawValue }
}
struct User: Hashable, Codable {
let id: GenericID<User>
let name: String
}
let json = """
{
"id": 5,
"name": "Name"
}
"""
import Foundation
print(try! JSONDecoder().decode(User.self, from: json.data(using: .utf8)!))
Any idea what I'm doing differently from you?
(Note that your JSON is missing a comma.)
Comment by Elshad Yarmetov (JIRA)
@belkadan thank you for your reply.
I also couldn't reproduce this in separate project. But in my project i have this problem. Below i put video link to problem.
Is there can be some relation with this problem?
https://bugs.swift.org/browse/SR-7315
Probably not; that problem kicks in before the optimizer gets a chance to run. Can you share your project? If you don't want to share it publicly, you can send it just to Apple at https://bugreport.apple.com.
@itaiferber, is this SR-5965?
Attachment: Download
Environment
Xcode 9.3, swift 4.1Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, Codable, OptimizedOnly | |Assignee | None | |Priority | Medium | md5: 5410ae8f3b6ce75c8a2255e9815b5f7crelates to:
Issue Description:
JSON string
Must be struct with type safe id
Codable actions not fire errors for below code on debug mode. But on release mode there are codable errors
Adding codable custom inits fix errors