mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Support extensions including conditional conformance * Correct access modifiers * More correct lookup for the synthesized declarations * Avoid printing decls in nested types (rdar://98025945)
29 lines
670 B
Plaintext
29 lines
670 B
Plaintext
|
|
struct User: Codable {
|
|
let firstName: String
|
|
let lastName: String?
|
|
}
|
|
|
|
struct User_D: Decodable {
|
|
let firstName: String
|
|
let lastName: String?
|
|
|
|
private enum CodingKeys: CodingKey {
|
|
case firstName
|
|
case lastName
|
|
}
|
|
|
|
init(from decoder: any Decoder) throws {
|
|
let container: KeyedDecodingContainer<User_D.CodingKeys> = try decoder.container(keyedBy: User_D.CodingKeys.self)
|
|
|
|
self.firstName = try container.decode(String.self, forKey: User_D.CodingKeys.firstName)
|
|
self.lastName = try container.decodeIfPresent(String.self, forKey: User_D.CodingKeys.lastName)
|
|
|
|
}
|
|
}
|
|
|
|
struct User_E: Encodable {
|
|
let firstName: String
|
|
let lastName: String?
|
|
}
|