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

Remove enums and strictly replace them with unions #906

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

mohammadfawaz
Copy link
Contributor

@mohammadfawaz mohammadfawaz commented Oct 2, 2024

  • Removes enums completely
  • Replaces all places where enums were used (in code and tests) with unions that behave like enum.. I'm calling them "enumeration unions".
  • Allow unions in storage. We need to address the ABI next.

closes #858

@mohammadfawaz mohammadfawaz marked this pull request as ready for review October 4, 2024 15:45
Comment on lines +401 to +404
let is_enumeration_union = Type::Union {
path: ty_path.clone(),
span: empty_span(),
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Creating the type like this from ty_path is not great and I think we're doing that somewhere else already so I did the same... but that should be improved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I'm keen now to have the union decls referred to by slotmap key instead of the crappy string matching the Custom types (and similar) do now.

otrho
otrho previously approved these changes Oct 7, 2024
@otrho otrho merged commit b85bbf6 into master Oct 7, 2024
8 checks passed
@otrho otrho deleted the mohammadfawaz/remove_enum branch October 7, 2024 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Enums and Unions in storage including storage maps and storage vectors.
2 participants