I think this is because .WHAT is a special case. It's not really a method which is what you need to make *.method work. *.WHAT will always return (Whatever) immediately.
There is an odd what of working around this: perl6 -e 'sub foo(\a where *.&WHAT === Int ) { say "Hello"; }; foo(10); # works using the &WHAT sub with postfix syntax you get around the special casing. I'm not sure if .WHAT special casing is considered a bug. I haven't been able to find a pre-existing ticket wrt to it. On Sat, Sep 24, 2016 at 4:42 PM Itsuki Toyota <perl6-bugs-follo...@perl.org> wrote: > # New Ticket Created by Itsuki Toyota > # Please include the string: [perl #129346] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=129346 > > > > See the following results > > $ perl6 -e 'sub foo(\a where { *.WHAT === Int } ) { say "Hello"; }; > foo(10);' > Constraint type check failed for parameter 'a' > in sub foo at -e line 1 > in block <unit> at -e line 1 > > $ perl6 -e 'sub foo(\a where -> \e { \e.WHAT === Int } ) { say "Hello"; }; > foo(10);' > Constraint type check failed for parameter 'a' > in sub foo at -e line 1 > in block <unit> at -e line 1 > > $ perl6 -e 'sub foo(\a where -> \e { e.WHAT === Int } ) { say "Hello"; }; > foo(10);' > Hello > > It seems that "Whatever *" cannot handle sigilless values correctly. > I think that the 1st example should return the same result as the 3rd > example. > > > > $ perl6 --version > This is Rakudo version 2016.08.1-202-g78393dd built on MoarVM version > 2016.08-47-g2eedba8 > implementing Perl 6.c. >