Subject: bug#66136: 29.1; byte-compiler reports "misplaced interactive spec" with empty fct in lexical environment

From: Jens Schmidt <[email-masked]>
Date: Sat, 23 Sep 2023 00:41:14 +0200

Stefan Monnier <[email-masked]> writes:

> I know Mattias played with this part of the code (mostly to try and
> figure what to do about the ordering of the various possible kinds of
> declarations, which is a related yet different issue).  Maybe he has
> a more informed opinion.

One more data point for opinion building: When byte-compiling a
completely empty function (no declarations, no body forms):

------------------------- snip -------------------------
(let ((lexical-binding t))
  (byte-compile
   '(defun foo (arg))))
------------------------- snip -------------------------

some upper layer already seems to replace the empty body by a sole nil,
which is then kept by function `macroexp-parse-body':

-------------------- *trace-output --------------------
1 -> (macroexp-parse-body (nil))
1 <- macroexp-parse-body: (nil nil)
-------------------- *trace-output --------------------

So probably we should mimic that in `macroexp-parse-body' if there are
declarations, but no body forms?  Or change that upper layer to also add
a sole nil in the declarations-only case?