-
-
Notifications
You must be signed in to change notification settings - Fork 43
Encode enum cases without associated values #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Can you provide what is the error you getting? The change seems to be in the right direction. So the tests might need to be updated with latest data. |
| } | ||
| } else { | ||
| preSyntax("\(values.first!)") | ||
| "break" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: You can add logic to conditionally include this break syntax depending on whether preSyntax returns any syntax.
| } | ||
| } | ||
|
|
||
| struct WithoutAssociatedVariables { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: You can add test case for your original example as well, without the CodedAt. You can add it to CodableTests
| generatedCode | ||
| } | ||
| } else { | ||
| preSyntax("\(values.first!)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will cause unused variable warnings in case of your original example. Can you address that in someway? May be passing some flag to this preSyntax closure and customizing the output based on this flag?
Fixes #157
This breaks some
@IgnoreCodingInitializedtests but that API is too confusing for me. I have no idea what it is actually supposed to do, so I can't tell if the failing tests are actually breaking the intended use. A maintainer needs to look at that.