From b5f171f98f46ac309e1678b7d1b5ea93f8b4a34d Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 4 Jun 2023 16:25:14 +0200 Subject: [PATCH] * lisp/emacs-lisp/comp.el (comp-function-type-spec): Improve. --- lisp/emacs-lisp/comp.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 696ed8d21f9..b65da148787 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4460,9 +4460,11 @@ 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))) - (unless type-spec - (setf kind 'inferred - type-spec (subr-type (symbol-function function)))) + (let ((f (symbol-function function))) + (when (and (null type-spec) + (subr-native-elisp-p f)) + (setf kind 'inferred + type-spec (subr-type f)))) (when type-spec (cons type-spec kind)))) -- 2.39.5