[perl #126703] Typed Shaped Arrays can't be initialized

[email protected] ("Jan-Olof Hendig via RT")
Newsgroups perl.perl6.compiler
Message-ID <[email protected]>
On Sat, 21 Nov 2015 06:48:27 -0800, timo wrote:
> Reproducing test:
> 
> my @a[3;3] = <a b c>, <d e f>, <g h i>; say @a; # works
> my Str @a[3;3] = <a b c>, <d e f>, <g h i>; say @a; # fails
> 
> 153852     jnthn │ m: say ((0 xx 10) xx 10).WHAT
> 153852  +camelia │ rakudo-moar : OUTPUT«(List)␤»
> 153857     jnthn │ Curious...
> 153933  timotimo │ how do you initialize the lists in your multidim 
> tests? :)
> 153935     jnthn │ Curious...I'd kinda have expected that to be a Seq...
> 153955     jnthn │ m: my @a[3;3] = <a b c>, <d e f>, <g h i>; say @a
> 153956  +camelia │ rakudo-moar : OUTPUT«[[a b c] [d e f] [g h i]]␤»
> 154002  timotimo │ mhh
> 154003     jnthn │ m: my @a[3;3] = <a b c> xx 3; say @a
> 154004  +camelia │ rakudo-moar : OUTPUT«[[a b c] [a b c] [a b c]]␤»
> 154014  timotimo │ m: my Str @a[3;3] = <a b c>, <d e f>, <g h i>; say @a
> 154014  +camelia │ rakudo-moar : OUTPUT«Type check failed in assignment 
> to ; expected Str but got List␤  in block
>                   │ <unit> at /tmp/XObUYCKoZZ:1␤␤»
> 154023     jnthn │ m: my @a[3;3] = ('a' xx 3) xx 3; say @a
> 154023  +camelia │ rakudo-moar : OUTPUT«[[a a a] [a a a] [a a a]]␤»
> 154032     jnthn │ Oh...
> 154037  timotimo │ it's really the type annotation; the type check seems 
> to happen in a/the wrong place
> 154047     jnthn │ Yes, looks like it.
> 

Fixed with commit 131367c7daa89d. Test needed.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.