Since the synthesized Encodable implementation for enums is externally tagged by key and we discard keys during encoding, enums currently use a completely untagged representation, which can make it hard to distinguish cases during decoding.
As described in the test case, we should investigate whether non-.untaggedAndAmbiguous strategies should throw an error, even though there may be a runtime cost to detect whether a type is an enum (e.g. through reflection)?
Since the synthesized
Encodable
implementation for enums is externally tagged by key and we discard keys during encoding, enums currently use a completely untagged representation, which can make it hard to distinguish cases during decoding.As described in the test case, we should investigate whether non-
.untaggedAndAmbiguous
strategies should throw an error, even though there may be a runtime cost to detect whether a type is an enum (e.g. through reflection)?