From de7158598fcd5440c0180ff6f83052c29e490bcd Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 30 Apr 2020 07:54:49 -0400 Subject: Revert "cl-loop: Calculate the array length just once" It fails when using 'and' (parallel bindings) for arrays (Bug#40727). * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Revert to recomputing array length. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-arrays): New test. --- test/lisp/emacs-lisp/cl-macs-tests.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/lisp/emacs-lisp') diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 9ca84f156a0..77609a42a99 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -39,6 +39,12 @@ collect (list c b a)) '((4.0 2 1) (8.3 6 5) (10.4 9 8))))) +(ert-deftest cl-macs-loop-and-arrays () + "Bug#40727" + (should (equal (cl-loop for y = (- (or x 0)) and x across [1 2] + collect (cons x y)) + '((1 . 0) (2 . -1))))) + (ert-deftest cl-macs-loop-destructure () (should (equal (cl-loop for (a b c) in '((1 2 4.0) (5 6 8.3) (8 9 10.4)) collect (list c b a)) -- cgit v1.2.3