On Fri Jul 30 07:14:54 2010, coke wrote:
> Opening a ticket on behalf of ovid...
> 
> 
> ---------- Forwarded message ----------
> From: Ovid <publiustemp-perl6compil...@yahoo.com>
> Date: Thu, Jul 29, 2010 at 9:44 AM
> Subject: Rakudo Star silent exit on subset violation?
> To: perl6-compi...@perl.org
> 
> 
> I don't know if this is reported (I can't find a bug report for it).
> 
> I just downloaded and compiled Rakudo Star.
> 
> $ uname -a
> Linux localhost.bbc.co.uk 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5
> 09:22:14
> UTC 2010 i686 GNU/Linux
> 
> The bug:
> 
> � �subset Int::Positive of Int where { $_ > 0 };
> 
> � �sub lotto (Int::Positive $count, Int::Positive $range) returns 
List
> {
> � � �die "$range must not be less than $count" if $range < $count;
> � � �return (1 .. $range).pick($count);
> � �}
> � �.say for lotto(-3,10);
> Note that the first argument to "lotto" is negative and thus violates
> the type
> constraint. �This code works fine if the first argument is a positive
> integer
> less than the second argument, but exits with no output otherwise.
> Making the
> second argument negative (and the first positive) hits the "die" line,
> so the
> type constraint is simply being ignored for negative numbers.
> 
> If I change the first argument to a float such as 3.2, it seems to
> round it up
> to 4.
> 
> Cheers,
> Ovid--
> Buy the book � � � � - http://www.oreilly.com/catalog/perlhks/
> Tech blog � � � � � �- http://blogs.perl.org/users/ovid/
> Twitter � � � � � � �- http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
> 
> 
> 
> 
> 

This now (git-latest rakudo compiler) fails properly:

$ ./perl6 foo
Constraint type check failed for parameter '$count'
  in sub lotto at foo:1
  in block <anon> at foo:6
  in <anon> at foo:1

Closable with tests.


-- 
Will "Coke" Coleda

Reply via email to