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 should behave like numeric types #390

Closed
ghaith opened this issue Dec 2, 2021 · 0 comments · Fixed by #404
Closed

Enums should behave like numeric types #390

ghaith opened this issue Dec 2, 2021 · 0 comments · Fixed by #404
Labels
bug Something isn't working

Comments

@ghaith
Copy link
Collaborator

ghaith commented Dec 2, 2021

Describe the bug
Enums are currently return true for is_numerical but do not actually support numeric operations
They cannot be compared with each other or other ints.

When trying to use a comparison function for an Enum rusty will currently fail on get_rank
If a rank is provided it fails with the error: Cannot cast from <enum> to REAL

@ghaith ghaith added the bug Something isn't working label Dec 2, 2021
riederm added a commit that referenced this issue Dec 5, 2021
ghaith pushed a commit that referenced this issue Dec 7, 2021
* allow datatype & initilaization for enums

myEnum : INT (a:=3, b, c, d:= 77, e, f);

* make enums comparable and castable

fixes #390

* Enum value resolution

* pre-proc creates expl assignments for enums elements

enum elements get explicit assignments so we can safely assume
an Assignment-Statement with an initial value for every
enum element.

* improvements, renames and small refactorings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant