This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deparse: mark "$a[0]\[1]" TODO
authorDavid Mitchell <davem@iabyn.com>
Fri, 19 Apr 2019 11:57:48 +0000 (12:57 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 19 Apr 2019 11:57:48 +0000 (12:57 +0100)
Currently Deparse fails to output a backslash, turning the result
into a multi-dimensional array lookup. This is a long-standing fault.
For now, mark it TODO, and remove the construct from uni/fold.t, which is
where I first spotted the issue by running 'TEST -deparse'.

lib/B/Deparse.t
t/uni/fold.t

index 138563a..384c56c 100644 (file)
@@ -3058,3 +3058,7 @@ $l = $s->$#*;
 $s->$#* = 1;
 $l = $#{@$s;};
 $#{$s;} = 1;
+####
+# TODO doesn't preserve backslash
+my @a;
+my $s = "$a[0]\[1]";
index a557fe3..bd1dd85 100644 (file)
@@ -166,7 +166,8 @@ foreach my $test_ref (@CF) {
         $test = qq[":$c:" =~ /:$every_other_bracketed_f:/iu];
         ok eval $test, "$code - $name - $mapping - $type - $test";
 
-        my $other_every_bracketed_f = "$f_chars[0]\[$f_chars[1]]";
+        my $other_every_bracketed_f = "$f_chars[0]";
+        $other_every_bracketed_f .= "[$f_chars[1]]";
         $other_every_bracketed_f .= "$f_chars[2]" if $f_chars[2];
         $test = qq[":$c:" =~ /:$other_every_bracketed_f:/iu];
         ok eval $test, "$code - $name - $mapping - $type - $test";