fix: foreach should not break init backtracking with DUPN (#3266)

Simplifies the compilation of `foreach` to avoid the problem in #3227 by
removing unnecessary `FORK ... BACKTRACK`.

Does not address `reduce`, which is less trivial.
This commit is contained in:
Nicole Wren authored and GitHub committed 2025-03-05 22:01:48 +09:00
1 parent f65d088b75
commit c70ae1ada4
2 files changed
+27 -39

No files matched your search

+8
View File
@@ -2319,3 +2319,11 @@ try ltrimstr("x") catch "x", try rtrimstr("x") catch "x" | "ok"
try ["OK", setpath([[1]]; 1)] catch ["KO", .]
[]
["KO","Cannot update field at array index of array"]
# regression test for #3227
foreach .[] as $x (0, 1; . + $x)
[1, 2]
1
3
2
4