mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-08 23:40:24 -08:00
Fix function arity check for noncompiled callees (bug#78685)
This fixes a regression from Emacs 29, and is the second attempt after
the later reverted 8b0f5b0597.
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition):
Make it work for functions that aren't compiled.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--f):
(bytecomp-tests--warn-arity-noncompiled-callee): Add test.
This commit is contained in:
parent
eca2cc00b6
commit
3f72004961
2 changed files with 28 additions and 7 deletions
|
|
@ -1454,13 +1454,19 @@ when printing the error message."
|
|||
(env (cdr (assq name list))))
|
||||
(or env
|
||||
(let ((fn name))
|
||||
(while (and (symbolp fn)
|
||||
(fboundp fn)
|
||||
(or (symbolp (symbol-function fn))
|
||||
(consp (symbol-function fn))
|
||||
(while
|
||||
(and (symbolp fn)
|
||||
(fboundp fn)
|
||||
(let ((s (symbol-function fn)))
|
||||
(and
|
||||
(or (symbolp s)
|
||||
(consp s)
|
||||
(and (not macro-p)
|
||||
(compiled-function-p (symbol-function fn)))))
|
||||
(setq fn (symbol-function fn)))
|
||||
(or (closurep s)
|
||||
(compiled-function-p s))))
|
||||
(progn
|
||||
(setq fn s)
|
||||
t)))))
|
||||
(let ((advertised (get-advertised-calling-convention
|
||||
(if (and (symbolp fn) (fboundp fn))
|
||||
;; Could be a subr.
|
||||
|
|
@ -1471,7 +1477,8 @@ when printing the error message."
|
|||
(if macro-p
|
||||
`(macro lambda ,advertised)
|
||||
`(lambda ,advertised)))
|
||||
((and (not macro-p) (compiled-function-p fn)) fn)
|
||||
((and (not macro-p) (or (closurep fn) (compiled-function-p fn)))
|
||||
fn)
|
||||
((not (consp fn)) nil)
|
||||
((eq 'macro (car fn)) (cdr fn))
|
||||
(macro-p nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue