-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Bool ~~ BooleanEnum returns true #4134
Comments
The observed behavior is correct. The point is: say BooleanEnum.^mro; # ((Bool) (Bool) (Int) (Cool) (Any) (Mu)) The only thing which confuses me here is the first enum SS (:a(3e0), :b(4e0));
say SS.^mro; # ((SS) (Num) (Cool) (Any) (Mu)) But otherwise the pattern of enum having the base type of its values is followed as expected. |
I'm not sure what point you're trying to make here.
Apparently:
Which would explain the observed behavior, but raises a bunch of new questions at the same time. |
An enumeration type is a subtype of the type of its values (which should all have a consistent type, otherwise it's an error). |
I get that. I totally expect |
My apologies, there is actually a problem. Apparently, say 3e0 ~~ SS; # False The same should be expected for |
Goodness, I managed to do the same thinko as @vrurg. At least I'm in good company... :-) |
Apparently, this issue has been fixed in the meantime: https://gist.github.com/Whateverable/f0e879eb4cfc6ce67c9dbc144a1b1c41 @Leont Do you think this issue can be closed now? |
We need a test for this case first. Resolution of this issue was unintentional, no specific test has been done. |
The Problem
For any enum that contains a Boolean value, e.g.
enum BooleanEnum (:!Lies, :Truth)
, matching a boolean against that enum's type object will return true even though the boolean is not an enumExpected Behavior
True ~~ BooleanEnum
returnsFalse
Actual Behavior
True ~~ BooleanEnum
returnsTrue
Environment
The text was updated successfully, but these errors were encountered: