Subject: bug#78792: [PATCH] Fix compilation of defalias with a constant macro cons pair

From: Mattias Engdegård <[email-masked]>
Date: Wed, 18 Jun 2025 10:11:09 +0200

>> byte-compile-file-form-defalias destructures (cons 'macro 'fn) and
>> '(macro . fn) the same way, so in the latter case fn would be unquoted,
>> and then eval would later signal (void-variable fn). this patch just
>> re-quotes fn, and adds a test for this scenario.

This seems to be a genuine bug indeed, thank you for reporting.

>> @@ -5159,7 +5159,8 @@ byte-compile-file-form-defalias
>>        (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)))

Patch looks fine as far as I can tell. There is a test (naturally!) as well.