Skip Menu |
Report information
Id: 131381
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: danielcliffordmiller [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Sat, 27 May 2017 00:58:56 -0500
To: <rakudobug [...] perl.org>
From: "Dan Miller" <danielcliffordmiller [...] gmail.com>
Subject: [BUG]function prototypes using array of subset type give type error
Download (untitled) / with headers
text/plain 107b

This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda

implementing Perl 6.c

 

 

Download test.pl6
application/octet-stream 335b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 364b
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?
Download (untitled) / with headers
text/plain 354b
Golfed version: m: -> UInt @ {}(Array[UInt].new) rakudo-moar 8ec181: OUTPUT: «Constraint type check failed in binding to parameter '<anon>'; expected UInt but got Array[UInt] (Array[UInt].new())␤ in block <unit> at <tmp> line 1␤␤» Works if you don't use `@` sigil: m: -> Positional[UInt] {}(Array[UInt].new) rakudo-moar 8ec181: ( no output )


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org