[SR-6323] Ability to verify enum associated values #48873
Labels
compiler
The Swift compiler in itself
feature
A feature request or implementation
swift evolution proposal needed
Flag → feature: A feature that warrants a Swift evolution proposal
Additional Detail from JIRA
md5: 0142b41cc37c5399ac8957c39ecd5d29
Issue Description:
With a struct, one can override the default constructor to verify the data meets certain preconditions:
However, the equivalent is not currently possible with enums:
I'm not sure what the syntax for this would be, but I'd like to be able to detect an invalid definition of this enum at "creation time", rather than having these preconditions in a method with Content as a parameter.
The text was updated successfully, but these errors were encountered: