[SR-9545] Decodable gotcha: "let" with default + coding key #51995
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Codable
Area → standard library: `Codable` and co.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
Environment
Swift 4.2.1.
Additional Detail from JIRA
md5: 408dcb6091fdb216039c20402dda3a46
Issue Description:
Structs with default
let
properties that are codable will always prefer the default.When an explicit coding keys is provided, Swift probably should not compile:
The
bar
coding key should be a red flag since that key will never be decoded in a synthesized decodable initializer.The text was updated successfully, but these errors were encountered: