On Sat Nov 08 09:32:09 2008, pmichaud wrote: > On Sat, Nov 08, 2008 at 12:54:52AM -0800, Ilya Belikin wrote: > > sub foo (@a) { 1.say for @a } > > foo((1,2,3,4)); # only one 1 > > foo([1,2,3,4]); # only one 1 > > foo( my @a = 1,2,3 ); # only one 1 > > > > This one really pesky bug :( > > I suspect this appeared as a result of the recent updates to > container semantics. > Bang on. There's a bit of a subtlety in that when we have a parameter we tend to wrap it in a Perl6Scalar (which we need to rename at some point I guess, but anyways...). This inherits from ObjectRef. *But* just because something was wrapped up in a Perl6Scalar to and enforce readonly-ness and additional type checking doesn't mean it should have ObjectRef semantics. Now we detect this and deref a level. Which fixes the bug, and all other spectests go on passing, so I think it's the right fix. Checked in as r33245.
> Oddly, we don't seem to have any tests for this in the spectest > suite (or if there are tests, we aren't running them for some > reason). > I unfudged the ones moritz++ added. Thanks, Jonathan