Open p6rt opened 7 years ago
This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
implementing Perl 6.c
OP's code in the attachment:
subset PositiveInt of Int where * > 0;
my Int $i = 4; my Int @i = (2,4);
my PositiveInt $p = 6; my PositiveInt @p = (2,4);
sub handle-ints (Int @i) {} sub handle-positive-ints (PositiveInt @p) {}
$i = -5; #$p = -5; # should fail
handle-ints(@i); #handle-ints( (2.2, 1.1) ); # should fail
handle-positive-ints(@p); # this fails?
Golfed version:
m: -> UInt @ {}(Array[UInt].new)
rakudo-moar 8ec181: OUTPUT: «Constraint type check failed in binding to parameter '\
Works if you don't use `@` sigil:
m: -> Positional[UInt] {}(Array[UInt].new) rakudo-moar 8ec181: ( no output )
Fudged test added: https://github.com/perl6/roast/pull/273
Migrated from rt.perl.org#131381 (status was 'new')
Searchable as RT131381$