From 61a54f8a5d305468b8c49799fb572b2bb0bf8b86 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 6 May 2025 22:53:01 -0400 Subject: [PATCH] (cl-generic-generalizers): Skip types that need arguments * lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) "cl-types-of": make sure the atomic derived type is valid. (cherry picked from commit 147113b3b5a89b401448424dd01c4ac915ea6081) --- lisp/emacs-lisp/cl-lib.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 0d64bb8d172..b566f587dbc 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -560,10 +560,13 @@ If ALIST is non-nil, the new pairs are prepended to it." nil (declare-function cl--type-generalizers "cl-extra" (type)) (cl-defmethod cl-generic-generalizers :extra "cl-types-of" (type) - "Support for dispatch on cl-types." - (if (and (symbolp type) (cl-type-class-p (cl--find-class type))) - (cl--type-generalizers type) - (cl-call-next-method)))) + "Support for dispatch on cl-types." + (if (and (symbolp type) (cl-type-class-p (cl--find-class type)) + ;; Make sure this derived type can be used without arguments. + (let ((expander (get type 'cl-deftype-handler))) + (and expander (ignore-error (funcall expander))))) + (cl--type-generalizers type) + (cl-call-next-method)))) (defun cl--old-struct-type-of (orig-fun object) (or (and (vectorp object) (> (length object) 0) -- 2.39.5