Subject: bug#77725: 31.0.50; Add support for types accepted by `cl-typep' to cl-generic?

From: David Ponce <[email-masked]>
Date: Wed, 7 May 2025 15:40:31 +0200

Please find attached another small patch for the method
`cl-generic-generalizers' in cl-lib.el.

It ensures that the derived type is still present in the
`cl--type-list', in order to signal an "unkonw specializer"
error, if the type was removed from the list because it
was in error.

David

diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 2de81311380..d7e68a852ef 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -570,7 +570,10 @@ cl-pairlis
   (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))
-             ;; Make sure this derived type can be used without arguments.
+             ;; Make sure this derived type is still in the precedence
+             ;; list (not removed because in error), and can be used
+             ;; without arguments.
+             (memq type cl--type-list)
              (let ((expander (get type 'cl-deftype-handler)))
                (and expander (ignore-errors (funcall expander)))))
         (cl--type-generalizers type)