[SR-12255] Mirror behaviour is unspecified and inconsistent for enums with zero-size or no associated values #54682
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Xcode 11.3.1, running in a Swift Playground. (Not sure if this runs Swift 5.1 / 5.2)
Additional Detail from JIRA
md5: 31b5e4ee726e4a8090abd3eff30a75e5
Issue Description:
My expected behaviour, based on the existing results for non-zero-size associated values, would be that Mirror maps cases with associated values to a tuple of the case name and any associated values. If the enum has no associated values, it's not obvious what the result should be, but I'd most expect a plain String case name.
The ideal behaviour, on the other hand, is subject to interpretation of how we should compromise with SE-0155 per the decision not to fully implement it. Under this proposal as written, I would have expected labels to be available as Strings in the reflected representation.
The current state of affairs is illustrated by this code sample:
SR-6921 is partly related, referring to the lack of reflection information for enum cases without associated values.
SR-10272 appears to be an alternative example of an associated value of zero size.
The text was updated successfully, but these errors were encountered: