Commit 54b48f4c7a for perl
commit 54b48f4c7a9f49a55e8e0f3b9aeede2f3cf890ff
Author: Paul Evans <leonerd@leonerd.org.uk>
Date: Mon Nov 16 20:56:18 2026 +0000
pp_hot.c: Fix `pp_iter` for indexed + refaliasing also for ARRAY
The previous commit (918ead4329) fixed a bug related to `foreach` loops
with refaliasing on `builtin::indexed` function calls in the LIST case,
but forgot to handle the ARRAY case also. This commit fixes this.
diff --git a/lib/builtin.t b/lib/builtin.t
index 8c23449e92..71a97454f6 100644
--- a/lib/builtin.t
+++ b/lib/builtin.t
@@ -442,7 +442,16 @@ package FetchStoreCounter {
}
ok(eq_array(\@output, ['[0]=<a b c>', '[1]=<d e f>']),
- 'foreach + builtin::indexed + refalias');
+ 'foreach + builtin::indexed LIST + refalias');
+
+ my @input = ( [qw( g h i )], [qw( j k l )] );
+ undef @output;
+ foreach my ( $idx, \@arr ) ( builtin::indexed( @input ) ) {
+ push @output, "[$idx]=<@arr>";
+ }
+
+ ok(eq_array(\@output, ['[0]=<g h i>', '[1]=<j k l>']),
+ 'foreach + builtin::indexed ARRAY + refalias');
}
# Vanilla trim tests
diff --git a/pp_hot.c b/pp_hot.c
index 8c0383aae4..6cd7cde166 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -5195,6 +5195,8 @@ PP(pp_iter)
++i;
++itersvp;
+
+ refalias_this = refalias_mask & (1<<i);
}
loop_ary_common: