-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enums roundtrip unknown variants #139
Conversation
Generate changelog in
|
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.
Test is broken. Options are to change the test code not to throw the warning or just bump verifier to 0.16.6, which has the new correct enum test cases.
), | ||
Body: []astgen.ASTStmt{ | ||
statement.NewReturn( | ||
expression.NewCallFunction("werror", "Convert", |
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.
What is the value in adding in the additional werror.Convert
given the NewInvalidArgument
will return a proper error?
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.
Adam asked the same question on Slack. This might be exposing a deficiency with how we implemented the conjure error, but because it's not a werror it doesn't have a stacktrace. I added the werror.Convert as low as possible to preserve the stack frame(s) between here and the next werror.Wrap.
Before this PR
Unknown enum variants were all assigned the
UNKNOWN
value, which is not in line with the conjure spec that specifies they should be stored and round-trippable. Partially addresses #24 (unions require more thought).After this PR
==COMMIT_MSG==
Enums now preserve unknown variant values. The
UNKNOWN
value has been removed.==COMMIT_MSG==
Possible downsides?
This might be a breaking change, especially if people are assuming the generated values are exhaustive (e.g. using switch statements without default cases)
This change is