1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 02:51:31 -08:00

Don't increment array index in cl-loop twice (Bug#40727)

* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Put the temp-idx
increment in cl--loop-body, leaving just the side-effect free testing
of the index for both cl--loop-body and cl--loop-conditions.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-arrays):
Extend test to cover this case.
This commit is contained in:
Noam Postavsky 2020-04-30 18:55:40 -04:00
parent de7158598f
commit ddc8020327
2 changed files with 5 additions and 1 deletions

View file

@ -43,6 +43,9 @@
"Bug#40727"
(should (equal (cl-loop for y = (- (or x 0)) and x across [1 2]
collect (cons x y))
'((1 . 0) (2 . -1))))
(should (equal (cl-loop for x across [1 2] and y = (- (or x 0))
collect (cons x y))
'((1 . 0) (2 . -1)))))
(ert-deftest cl-macs-loop-destructure ()