On Sat Sep 10 17:09:52 2011, bbkr wrote:
> But does not check subtypes as expected, this should not pass:
> 
> bbkr:nom bbkr$ ./perl6 -e 'sub foo(--> Array of Str) { my Str @a =
> "foo", "bar", "baz", 666; @a }; foo.perl.say'
> Array.new("foo", "bar", "baz", 666)

We've lost ground here:

$ cat strings.pl 
sub foo(--> Array of Str) {
    my Str @a = <foo bar baz>;
    @a
};
foo.perl.say
$ ./perl6 strings.pl 
Type check failed for return value; expected 'Array+{TypedArray}' but got 
'Array+{TypedArray}'
  in sub foo at strings.pl:3
  in block  at strings.pl:5

$ cat mixed.pl 
sub foo(--> Array of Str) {
    my Str @a = "foo", "bar", 123;
    @a
};
foo.perl.say
$ ./perl6 mixed.pl 
Type check failed for return value; expected 'Array+{TypedArray}' but got 
'Array+{TypedArray}'
  in sub foo at mixed.pl:3
  in block  at mixed.pl:5

strings.pl  shouldn't be failing on the return, and mixed.pl should be failing 
on the assignment.

-- 
Will "Coke" Coleda

Reply via email to