On 05/19/2013 06:41 PM, Elizabeth Mattijsen (via RT) wrote:
> # New Ticket Created by Elizabeth Mattijsen
> # Please include the string: [perl #118053]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118053 >
>
>
> [18:35:53] <lizmat> r: sub a ($a=Mu) { }; a
> [18:35:54] <+camelia> rakudo 9c5650: OUTPUT«Nominal type check failed for
> parameter '$a'; expected Any but got Mu instead in sub a at
> /tmp/IvMlnzFJOY:1 in block at /tmp/IvMlnzFJOY:1»
> [18:36:18] <lizmat> expected Any? but but, I specified Mu as the default
Any is the default type constraint if you specify none; So you specify a
default that doesn't pass the type constraint, and it dies when you
don't specify a value.
If you want it to be able to receive a Mu, you have to add a type
constraint:
sub a(Mu $a = Mu) { }; a;
or simply
sub a(Mu $a?) { }; a;
So, not a bug.
Cheers,
Moritz