]> git.eshelyaron.com Git - emacs.git/commitdiff
(cl-generic-generalizers): Skip types that need arguments
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 7 May 2025 02:53:01 +0000 (22:53 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:53:25 +0000 (10:53 +0200)
* 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

index 0d64bb8d17273956b2b384b324b04eba93f97106..b566f587dbc29f2d10bcfc48a519b3625294d1b4 100644 (file)
@@ -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)