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

Enums are not translated correctly #102

Closed
franziskuskiefer opened this issue Dec 6, 2024 · 1 comment · Fixed by #114
Closed

Enums are not translated correctly #102

franziskuskiefer opened this issue Dec 6, 2024 · 1 comment · Fixed by #114

Comments

@franziskuskiefer
Copy link
Collaborator

The following Rust code

enum Error1 {
    Reason1 = 1,
    Reason2 = 2,
}

enum Error2 {
    Reason1 = 3,
    Reason2 = 4,
}

Is translated into

#define eurydice_tests_Reason1 0
#define eurydice_tests_Reason2 1

typedef uint8_t eurydice_tests_Error1;

typedef eurydice_tests_Error1 eurydice_tests_Error2;
@msprotz
Copy link
Contributor

msprotz commented Dec 19, 2024

Right so this is the conflation of two issues.

  1. Enum definitions are hash-consed (which is fine), since it optimizes code quality
  2. We ignore the value of an enum tag

Fixing the latter will fix this issue. I don't think 1. is a problem

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 a pull request may close this issue.

2 participants