Skip to content
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

Add Support for Compact Enums #686

Merged

Conversation

InsertCreativityHere
Copy link
Member

This PR implements #681 by adding support for compact enums.
Compact enums work just like compact structs: we don't encode TagEndMarker, and tags cannot be used within the enum.

A compact enum cannot have an underlying type (since they're already 'compact') nor can it be unchecked (since we already don't encode TagEndMarker then).

})
.set_span(enum_def.span())
.add_note(
"compact enums cannot also have underlying types\ntry removing either the 'compact' modifier, or the underlying type",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should try to avoid using newlines in these notes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll change them all to other punctuation.

What's the problem with newlines though?
The console output will already have newlines from snippets, and the json output is all string-escaped.

Comment on lines 379 to 381
CompactTypeCannotContainTaggedFields,
format!("tagged fields are not supported in compact {kind}s\nconsider removing the tag, or making the {kind} non-compact"),
kind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @externl on the new lines in the error descriptions. Do we do this anywhere else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few scattered around notes and error messages.
Just whenever something seemed more readable on two lines.

@InsertCreativityHere InsertCreativityHere merged commit afba8cf into icerpc:main Dec 13, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants