You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unsure whether the following should work, but it doesn't:
perl6 -e 'enum E <foo bar>; my E $x=E::bar; given $x { when E::foo {say
"FOO"} when E::bar {say "BAR"}};'
Method 'ACCEPTS' not found for invocant of class ''
The problem seems to be that the 'when' cannot perform a smart match on an
enum member. A workaround is to cast the enum member to an int, but this
is surely not as intended:
perl6 -e 'enum E <foo bar>; my E $x=E::bar; given $x { when int E::foo
{say "FOO"} when int E::bar {say "BAR"}};'
BAR
On Sat Mar 21 02:42:29 2009, autoexec@xs4all.nl wrote:
Unsure whether the following should work, but it doesn't:
perl6 -e 'enum E <foo bar>; my E $x=E::bar; given $x { when E::foo {say
"FOO"} when E::bar {say "BAR"}};'
Method 'ACCEPTS' not found for invocant of class ''
The problem seems to be that the 'when' cannot perform a smart match on an
enum member.
That was the problem, and it's now fixed in e33c004; unfudged some tests
for smartmatching on enum values, added a couple to S12-enums/basic.t
that explicitly try it out with given/when.
Migrated from rt.perl.org#64046 (status was 'resolved')
Searchable as RT64046$
The text was updated successfully, but these errors were encountered: