(pcase-let*
;; `macro' is non-nil if it defines a macro.
;; `fun' is the function part of `arg' (defaults to `arg').
- (((or (and (or `(cons 'macro ,fun) `'(macro . ,fun)) (let macro t))
+ (((or (and (or `(cons 'macro ,fun) `'(macro . ,(app (list 'quote) fun)))
+ (let macro t))
(and (let fun arg) (let macro nil)))
arg)
;; `lam' is the lambda expression in `fun' (or nil if not
(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)