-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow to create an enum from a macro symbol #8634
Allow to create an enum from a macro symbol #8634
Conversation
spec/std/enum_spec.cr
Outdated
enum_value = | ||
{% begin %} | ||
SpecEnum.from_self({{ :two }}) | ||
{% end %} |
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.
Note: I'm not sure why I need to use macro begin/end here, otherwise it fails with:
no overload matches 'SpecEnum.from_self' with type Symbol
I guess it's because auto-casted symbols are resolved earlier then macro expansion?
Pretty weird CI error for
|
To be honest I don't understand the use case. Why would you get a symbol from somewhere? And if you do get a symbol, why don't you compare symbols instead of enums? |
@asterite in my case I had an annotation with symbols that should map to real enum values. |
Thanks! |
Closes #8573