1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

(cl-flet, cl-labels): Fix bug#74870

* lisp/emacs-lisp/cl-macs.el (cl-flet, cl-labels): Wrap function
bodies in `cl-block`.

* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--test-flet-block): New test.
This commit is contained in:
Stefan Monnier 2024-12-21 11:13:07 -05:00
parent a1d08d2c13
commit 4764261681
2 changed files with 41 additions and 16 deletions

View file

@ -718,6 +718,16 @@ collection clause."
(f lex-var)))))
(should (equal (f nil) 'a)))))
(ert-deftest cl-macs--test-flet-block ()
(should (equal (cl-block f1
(cl-flet ((f1 (a) (cons (cl-return-from f1 a) 6)))
(cons (f1 5) 6)))
'(5 . 6)))
(should (equal (cl-block f1
(cl-labels ((f1 (a) (cons (cl-return-from f1 a) 6)))
(cons (f1 7) 8)))
'(7 . 8))))
(ert-deftest cl-flet/edebug ()
"Check that we can instrument `cl-flet' forms (bug#65344)."
(with-temp-buffer