aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorZach Shaftel2025-06-14 20:57:21 -0400
committerEli Zaretskii2025-06-21 11:40:17 +0300
commit075ebed98fea274b363d4d015b32edb0a12a9a89 (patch)
treef5d9ad83cf5b7f317c85a16dc89593f29a3bb630 /test
parent39721a4d79a6056e09f4d0996f1942eee8e34934 (diff)
downloademacs-075ebed98fea274b363d4d015b32edb0a12a9a89.tar.gz
emacs-075ebed98fea274b363d4d015b32edb0a12a9a89.zip
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)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index d1f272f7a4d..7382928da15 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1322,6 +1322,24 @@ byte-compiled. Run with dynamic binding."
1322 (defun def () (m)))) 1322 (defun def () (m))))
1323 (should (equal (funcall 'def) 4))) 1323 (should (equal (funcall 'def) 4)))
1324 1324
1325(ert-deftest test-eager-load-macro-expand-defalias ()
1326 (ert-with-temp-file elfile
1327 :suffix ".el"
1328 (write-region
1329 (concat ";;; -*- lexical-binding: t -*-\n"
1330 (mapconcat #'prin1-to-string
1331 '((defalias 'nothing '(macro . ignore))
1332 (defalias 'something (cons 'macro #'identity))
1333 (defalias 'five (cons 'macro (lambda (&rest _) 5)))
1334 (eval-when-compile
1335 (defun def () (or (nothing t) (something (five nil))))))
1336 "\n"))
1337 nil elfile)
1338 (let* ((byte-compile-debug t)
1339 (byte-compile-dest-file-function #'ignore))
1340 (byte-compile-file elfile)
1341 (should (equal (funcall 'def) 5)))))
1342
1325(defmacro bytecomp-tests--with-temp-file (file-name-var &rest body) 1343(defmacro bytecomp-tests--with-temp-file (file-name-var &rest body)
1326 (declare (indent 1)) 1344 (declare (indent 1))
1327 (cl-check-type file-name-var symbol) 1345 (cl-check-type file-name-var symbol)