This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Restore prev. behaviour of @a||... in lv sub
authorFather Chrysostomos <sprout@cpan.org>
Thu, 24 Oct 2013 17:53:46 +0000 (10:53 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 24 Oct 2013 17:54:27 +0000 (10:54 -0700)
commit32cbae3f95283fbf92f1e0d0d188dbb5d5ad5804
tree66bec29e7de1e1166d2e42bdc018e2bfae5b4fcf
parenta373464fd655c7246cf689f421efc503307b705c
Restore prev. behaviour of @a||... in lv sub

$ perl5.18.1 -lwe 'my @a;  sub i:lvalue {@a||@b} @a=1; (i())=3'
Name "main::b" used only once: possible typo at -e line 1.
Useless assignment to a temporary at -e line 1.

Bleadperl:

$ ./perl -Ilib -lwe 'my @a; sub i:lvalue {@a||@b} @a=1; (i())=3'
Name "main::b" used only once: possible typo at -e line 1.
Can't return array to lvalue scalar context at -e line 1.

I accidentally changed it in commit 2ec7f6f242 by propagating the
lvalue context.  This commit changes it back by only flagging the
rv2av op as being in an lvalue sub if it is not already flagged as
being in scalar context.

The old behaviour was inconsistent, and this commit does restore it
(see the tests), but resolving that discrepancy is for a future commit
(if I ever get to it).

In any case, â€˜Can't return array to lvalue scalar context’ is wrong.
op.c
t/op/sub_lval.t