You overlooked a mistype. The subset expects "wuhn", you pass "whun" instead. 
Guess, the subset is wrong about it. :)

Best regards,
Vadim Belman

> On Sep 22, 2021, at 8:39 PM, Joseph Brenner <doom...@gmail.com> wrote:
> 
> In this code I'm using multi-dispatch with a subset type that
> makes string values special: "wuhn", "tew" and "thuree".
> 
>    use Test;
> 
>    multi sub whats_my_type (Str $item) {
>        return "This is a Str: $item";
>    }
> 
>    subset GoofyNum of Str where { $_ eq any( 'wuhn', 'tew', 'thuree' ) };
>    multi sub whats_my_type (GoofyNum $item) {
>        return "This is a GoofyNum string: $item";
>    }
> 
>    {
>        my ($ret, $arg);
>        $ret =  whats_my_type('two');
>        like $ret, /<< Str >>/, "quoted string argument of 'two' is Str";
> 
>        $ret = whats_my_type('tew');
>        like $ret,  /<< GoofyNum >>/, "quoted string argument of
> 'wuhn' is 'goofy'";
> 
>        $arg = "one";
>        $ret = whats_my_type( $arg );
>        like $ret, /<< Str >>/, "string in var argument of '$arg' is Str";
> 
>        $arg = "whun";
>        $ret = whats_my_type( $arg );
>        like $ret, /<< GoofyNum >>/, "string in var argument of 'wuhn'
> is 'goofy'";
>    }
> 
> 
> I would think all four of these tests should pass, instead I see
> the last one failing: for some reason there's a difference in the
> case of a simple quoted string, and a string inside a variable.
> 
> Any comments?
> 
> 
> raku --version
> Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10.
> Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
> Built on MoarVM version 2020.10.
> 
> uname -a
> Linux fandango 4.9.0-8-686 #1 SMP Debian 4.9.144-3 (2019-02-02) i686 GNU/Linux
> 

Reply via email to