-
-
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
Question method on member with value 0 in enum with flags attribute broken #7249
Comments
Why do you use |
@j8r This is just an example. Currently only the
And another effect of having pp Animal::UNKNOWN # => None |
Fun fact, a crystal/src/compiler/crystal/semantic/top_level_visitor.cr Lines 585 to 591 in 5502b00
But this means if I define a @[Flags]
enum Animal
None = 0
DOG
CAT
LAMA
end
pp Animal::None.none? # => false |
I still think we should remove the autogenerated |
Whether we keep them or not, does not change the fact that we need to define the right question method for a member with a value of |
@petoem It's failing right now because there's special logic in |
Yeah, for example replacing this ...
with this ... if is_flags && counter == 0
define_enum_question_method(enum_type, member, false)
else
define_enum_question_method(enum_type, member, is_flags)
end ... should define the correct question method. |
Related to #7285 |
Code:
https://play.crystal-lang.org/#/r/5wi8
The text was updated successfully, but these errors were encountered: