I get a warning for FL2 Scalar value @row[FL2] better written as $row[FL2] (ignoring that its a constant _list_)
$ ./Porting/bisect.pl --target=miniperl --start=v5.16.3 --end=v5.26.0 +--expect-fail -e 'use warnings FATAL=>"all"; sub X () {2,3}; my @a=(" +a".."z"); print @a[X]' ... commit 429a25554a608b64c0ee46c1ffe19bab3718a3c8 Author: Father Chrysostomos <sprout@cpan.org> Date: Sat Sep 14 17:23:11 2013 -0700 Reduce false positives for @hsh{$s} and @ary[$s] warnings This resolves tickets #28380 and #114024. Commit 95a31aad5 did something similar to this for the new %hash{. +..} syntax. This commit extends it to @ slices and combines the two code paths. The heuristics in toke.c can easily produce false positives. So t +he op is flagged as being a candidate for the warning. Then when op. +c has the op tree available, it examines it to see whether the heuri +stic may have been a false positive. This avoids bugs with qw "foo bar baz" and sub calls triggering the warning. The source code is no longer available for the warning, so we reco +n- struct it from the op tree, skipping the subscript if it is anythi +ng other than a const op. This means that @hash{$foo} comes out as @hash{...} and @hash{foo} + as @hash{"foo"}. It also meeans that @hash{"]"} is displayed correct +ly instead of as @hash{"]. Commit 95a31aad5 also modified the heuristic for %hash{...} to exe +mpt qw altogether. But it did not exempt it if it was preceded by a t +ab. So this commit rectifies that. This commit also improves the false positive detection by exemptin +g any ops returning lists that can get past toke.c’s heuristic. I w +ent through the entire list of ops, but I may have missed some. Also, @ slices on the lhs of = are exempt, as they change the cont +ext and are hence actually useful. $ git tag --contains 429a25554a608b6 ... v5.20.0 ...
Deparsing the code shows that FL and FL2 are called as functions @a[FL()] = @row[FL2()];
$ ./Porting/bisect.pl --start=v5.16.3 --end=v5.26.0 -e '`$^X -Ilib -MO +=Deparse -e "use constant X=>3,4; \@x[X]"`=~/\@x\[3, 4\]/ and die' ... commit f815dc14d7c5540dfb5d02d001e0101c6266f281 Author: Father Chrysostomos <sprout@cpan.org> Date: Sun Jun 30 00:20:33 2013 -0700 Inline list constants These are inlined the same way as 1..5. We have two ops: rv2av | `-- const The const op returns an AV, which is stored in the op tree, and th +en rv2av flattens it. $ git tag --contains f815dc14d7c5540d ... v5.20.0 ... # *Update:* making sure it's not just the Deparse output that changed. +.. $ ./Porting/bisect.pl --start=v5.19.0 --end=v5.21.0 -e '`$^X -Ilib -MO +=Concise -e "use constant X=>3,4; \@x[X]"`=~/entersub/ or die' ... commit f815dc14d7c5540dfb5d02d001e0101c6266f281

In reply to Re: Constants lists in array slices by haukex
in thread Constants lists in array slices by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.