From 991bf3f0f5dff66794785ebfcc867611fe75e0da Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 18 Sep 2023 10:04:57 +0200 Subject: [PATCH] * Fix comp-function-type-spec for non symbol input (bug#66021) * lisp/emacs-lisp/comp.el (comp-function-type-spec): Make it robust against closures (bug#66021). --- lisp/emacs-lisp/comp.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index bb4552459dd..e1bb70fe5d4 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4506,8 +4506,10 @@ inferred from the code itself by the native compiler; if it is type-spec ) (when-let ((res (gethash function comp-known-func-cstr-h))) (setf type-spec (comp-cstr-to-type-spec res))) - (let ((f (symbol-function function))) - (when (and (null type-spec) + (let ((f (and (symbolp function) + (symbol-function function)))) + (when (and f + (null type-spec) (subr-native-elisp-p f)) (setf kind 'inferred type-spec (subr-type f)))) -- 2.39.2