diff options
author | David Mitchell <davem@iabyn.com> | 2017-12-25 10:40:58 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-12-25 11:21:07 +0000 |
commit | f08f2d0393c6f2ccdfc17ed791cd9956d95eaa4e (patch) | |
tree | 495b03a6fdf1cd69db62ad5589535c599654aaea /t/opbasic | |
parent | 06c214d653ac955e506914a26f8f9ab8917a6f41 (diff) | |
download | perl-f08f2d0393c6f2ccdfc17ed791cd9956d95eaa4e.tar.gz |
mutlitconcat: fix non-folding adjacent consts
RT ##132646
v5.27.6-120-gbcc30fd changed multiconcat so that adjacent constants
weren't folded, so that ($overloaded . "a" . "b") is invoked as
$overloaded->concat("a")->concat("b")
rather than
$overloaded->concat("ab")
It did this by 'demoting' every second adjacent const as a real arg rather
than adding it to the const string. However, that could leave a
multiconcat op with more than the maximum allowed args.
So include demotion candidates as part of the arg count.
Diffstat (limited to 't/opbasic')
-rw-r--r-- | t/opbasic/concat.t | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/t/opbasic/concat.t b/t/opbasic/concat.t index 55965c1702..42851d23b9 100644 --- a/t/opbasic/concat.t +++ b/t/opbasic/concat.t @@ -39,7 +39,7 @@ sub is { return $ok; } -print "1..251\n"; +print "1..252\n"; ($a, $b, $c) = qw(foo bar); @@ -810,3 +810,33 @@ ok(ref(CORE::state $y = "a $o b") eq 'o', is($got, $expected, "long concat chain $i"); } } + +# RT #132646 +# with adjacent consts, the second const is treated as an arg rather than a +# consts. Make sure this doesn't exceeed the maximum allowed number of +# args +{ + my $x = 'X'; + my $got = + 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + . 'A' . $x . 'B' . 'C' . $x . 'D' + ; + is ($got, + "AXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXDAXBCXD", + "RT #132646"); +} |