Repository navigation
Swift: Ensure all enum case labels are lowercased - #100
Merged
Merged
Conversation
tadfisher
requested review from
josephsumabat and
kylebshr
and removed request for
josephsumabat
June 10, 2026 21:21
tadfisher
force-pushed
the
tad/swift-lowercase-enum
branch
from
June 10, 2026 22:08
2326e76 to
b6d1d92
Compare
Will not build as HLS doesn't support it
Always conform to a raw value type and Codable, otherwise the JSON representation doesn't make sense.
tadfisher
force-pushed
the
tad/swift-lowercase-enum
branch
from
June 11, 2026 00:33
74a708a to
0886d27
Compare
aminnzzz
reviewed
Jun 11, 2026
| var container = encoder.container(keyedBy: CodingKeys.self) | ||
| switch (self) { | ||
| case let .dataCons0: | ||
| case let .dataCons0(enumField0, enumField1): |
There was a problem hiding this comment.
How come we did not have enumField0, enumField1 before, but in the encode and decode functions they were used? I think this is right I am just curious how it worked before this fix :-)
Collaborator
Author
There was a problem hiding this comment.
It didn't work, this was pulled from #96 to fix sums using TaggedFlatEncodingStyle.
tadfisher
force-pushed
the
tad/swift-lowercase-enum
branch
from
June 11, 2026 16:42
3fb8bdc to
1964703
Compare
josephsumabat
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the Swift backend emits enum cases verbatim to match the constructor name in Haskell. It's a fairly strong idiom for these to be lowercased, so when Moat is configured to preserve the Haskell name (via
constructorLowerFirst = False), it is possible for Moat to generate undesirable code.There's a bunch of housekeeping in the first two commits; I can separate these if needed.