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
This bug is for rakudo version 2015.11-283-g0ede335 built on MoarVM
version 2015.11-21-g469ba64 implementing Perl v6.b.
Take the following code:
subset Empty of Str where /^$/;
say "assignment:";
try my Empty $x = "a";
say $!.message;
say $!.^name;
say "binding:";
sub f(Empty $) {}
try f("a");
say $!.message;
say $!.^name;
This outputs:
assignment:
Type check failed in assignment to $x; expected Empty but got Str
X::TypeCheck::Assignment
binding:
Constraint type check failed for parameter '<anon>'
X::AdHoc
The X::AdHoc is wrong I think, it should be a X::TypeCheck::Binding,
analogous to the assignment.
Using a non-subset type also works correctly, if you can get it through
the compiler saying it'll never work:
sub g(Str $) {}
try g(False ?? "" !! 1); # thwart compiler
say $!.message;
say $!.^name;
Outputs:
Type check failed in binding <anon>; expected Str but got Int
X::TypeCheck::Binding
Migrated from rt.perl.org#126763 (status was 'open')
Searchable as RT126763$
The text was updated successfully, but these errors were encountered: