diff options
author | Philipp Stephani <phst@google.com> | 2020-08-02 17:17:00 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2020-08-02 17:39:24 +0200 |
commit | d8ab98843edccd233c2354d3c518c7a4b18023bd (patch) | |
tree | ad0785f91068e823fd3b74782c19d8e05d9bb572 /test/lisp/emacs-lisp | |
parent | a07ec21bf24b8d1dc41808f997dd0fb78cad3870 (diff) | |
download | emacs-d8ab98843edccd233c2354d3c518c7a4b18023bd.tar.gz emacs-d8ab98843edccd233c2354d3c518c7a4b18023bd.tar.bz2 emacs-d8ab98843edccd233c2354d3c518c7a4b18023bd.zip |
Avoid duplicate Edebug symbols when using ‘cl-flet’ (Bug#41989)
* lisp/emacs-lisp/edebug.el (edebug-match-:unique): Add a new
‘:unique’ specifier to generate unique names.
* lisp/emacs-lisp/cl-macs.el (cl-flet): Use it. This requires
inlining the ‘cl-defun’ specification.
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-cl-flet): New
unit test.
* doc/lispref/edebug.texi (Specification List): Document new ‘:unique’
construct.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/edebug-tests.el | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el index 89b1f293743..be9f1503795 100644 --- a/test/lisp/emacs-lisp/edebug-tests.el +++ b/test/lisp/emacs-lisp/edebug-tests.el @@ -960,5 +960,45 @@ primary ones (Bug#42671)." (list (intern "edebug-cl-defmethod-qualifier :around ((_ number))") (intern "edebug-cl-defmethod-qualifier ((_ number))"))))))) +(ert-deftest edebug-tests-cl-flet () + "Check what Edebug can instrument `cl-flet' forms without name +clashes (Bug#41853)." + (with-temp-buffer + (dolist (form '((defun edebug-tests-cl-flet-1 () + (cl-flet ((inner () 0)) (message "Hi")) + (cl-flet ((inner () 1)) (inner))) + (defun edebug-tests-cl-flet-2 () + (cl-flet ((inner () 2)) (inner))))) + (print form (current-buffer))) + (let* ((edebug-all-defs t) + (edebug-initial-mode 'Go-nonstop) + (instrumented-names ()) + (edebug-new-definition-function + (lambda (name) + (when (memq name instrumented-names) + (error "Duplicate definition of `%s'" name)) + (push name instrumented-names) + (edebug-new-definition name))) + ;; Make generated symbols reproducible. + (gensym-counter 10000)) + (eval-buffer) + (should (equal (reverse instrumented-names) + ;; The outer definitions come after the inner + ;; ones because their body ends later. + ;; FIXME: There are twice as many inner + ;; definitions as expected due to Bug#41988. + ;; Once that bug is fixed, remove the duplicates. + ;; FIXME: We'd rather have names such as + ;; `edebug-tests-cl-flet-1@inner@cl-flet@10000', + ;; but that requires further changes to Edebug. + '(inner@cl-flet@10000 + inner@cl-flet@10001 + inner@cl-flet@10002 + inner@cl-flet@10003 + edebug-tests-cl-flet-1 + inner@cl-flet@10004 + inner@cl-flet@10005 + edebug-tests-cl-flet-2)))))) + (provide 'edebug-tests) ;;; edebug-tests.el ends here |