From 3bc4ee4c5aa3ed1ba3b33fb9d35f9196144d5420 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 2 Jul 2010 22:06:49 +0100 Subject: overload.t: clarify concat #FETCH expected It turns out that the number of FETCHes for the fallback ($tied_ovld . foo) just needed explaining, not fixing. --- lib/overload.t | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/overload.t b/lib/overload.t index 986073277f..7d4dbff315 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -1730,22 +1730,16 @@ foreach my $op (qw(<=> == != < <= > >=)) { "do { my \$arg = %s; \$_[2] ? (3 $op \$arg) : (\$arg $op 3) }"; # ARRAY FETCH: initial # SCALAR FETCH: initial eval-return, - # with fallback, we just stringify, so eval-return skipped - - # XXX TODO concat overload with fallback calls FETCH too often - if ($_ eq '.') { - push @tests, [ 18, "%s $op 3", "($_)", '("")', - [ 1, 2, 0, 1, 2, 0 ], 1 ]; - push @tests, [ 18, "3 $op %s", "($_)", '("")', - [ 1, 2, 0, 1, 2, 0 ], 1 ]; - } - else { - push @tests, [ 18, "%s $op 3", "($_)", '("")', - [ 1, 2, 0, 1, 1, 0 ], 1 ]; - next if $_ eq 'x'; # repeat only overloads on LHS - push @tests, [ 18, "3 $op %s", "($_)", '("")', - [ 1, 2, 0, 1, 1, 0 ], 1 ]; - } + # with fallback, we just stringify, so eval-return skipped, + # but an extra FETCH happens in sub"", except for 'x', + # which passes a copy of the RV to sub"", avoiding the + # second FETCH + + push @tests, [ 18, "%s $op 3", "($_)", '("")', + [ 1, 2, 0, 1, ($_ eq '.' ? 2 : 1), 0 ], 1 ]; + next if $_ eq 'x'; # repeat only overloads on LHS + push @tests, [ 18, "3 $op %s", "($_)", '("")', + [ 1, 2, 0, 1, 2, 0 ], 1 ]; } for (qw(++ --)) { -- cgit v1.2.1