mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 14:30:50 -08:00
Fix byte-compilation of defalias with a constant macro cons pair
* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defalias): Quote the function name in '(macro . function-name), since we eval it later. * test/lisp/emacs-lisp/bytecomp-tests.el (test-eager-load-macro-expand-defalias): New test. (Bug#78792)
This commit is contained in:
parent
39721a4d79
commit
075ebed98f
2 changed files with 20 additions and 1 deletions
|
|
@ -1322,6 +1322,24 @@ byte-compiled. Run with dynamic binding."
|
|||
(defun def () (m))))
|
||||
(should (equal (funcall 'def) 4)))
|
||||
|
||||
(ert-deftest test-eager-load-macro-expand-defalias ()
|
||||
(ert-with-temp-file elfile
|
||||
:suffix ".el"
|
||||
(write-region
|
||||
(concat ";;; -*- lexical-binding: t -*-\n"
|
||||
(mapconcat #'prin1-to-string
|
||||
'((defalias 'nothing '(macro . ignore))
|
||||
(defalias 'something (cons 'macro #'identity))
|
||||
(defalias 'five (cons 'macro (lambda (&rest _) 5)))
|
||||
(eval-when-compile
|
||||
(defun def () (or (nothing t) (something (five nil))))))
|
||||
"\n"))
|
||||
nil elfile)
|
||||
(let* ((byte-compile-debug t)
|
||||
(byte-compile-dest-file-function #'ignore))
|
||||
(byte-compile-file elfile)
|
||||
(should (equal (funcall 'def) 5)))))
|
||||
|
||||
(defmacro bytecomp-tests--with-temp-file (file-name-var &rest body)
|
||||
(declare (indent 1))
|
||||
(cl-check-type file-name-var symbol)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue