]> git.eshelyaron.com Git - emacs.git/commitdiff
comp-cstr.el: Fix a minor error and prepare for upcoming changes
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 7 Mar 2024 21:56:42 +0000 (16:56 -0500)
committerEshel Yaron <me@eshelyaron.com>
Mon, 11 Mar 2024 09:15:41 +0000 (10:15 +0100)
* lisp/emacs-lisp/comp-cstr.el (comp--cl-class-hierarchy): Add `atom`
and `t` only to those types whose "allparents" is clearly not complete.
(comp--compute--pred-type-h): Store the cstr rather than the type
in the hash-table, as expected by `comp--pred-to-cstr`.

(cherry picked from commit 9830421e964cfb39077b69efd38d122e3bacf5d4)

lisp/emacs-lisp/comp-cstr.el

index 55d92841cd52c0e667396577a87f14d8b3ae2d4b..1c6acaa638579a5bd405b5a72bcdaa8a00b1cc4a 100644 (file)
@@ -89,12 +89,15 @@ Integer values are handled in the `range' slot.")
 
 (defun comp--cl-class-hierarchy (x)
   "Given a class name `x' return its hierarchy."
-  `(,@(cl--class-allparents (cl--struct-get-class x))
-    ;; FIXME: AFAICT, `comp--all-classes' will also find those struct types
-    ;; which use :type and can thus be either `vector' or `cons' (the latter
-    ;; isn't `atom').
-    atom
-    t))
+  (let ((parents (cl--class-allparents (cl--struct-get-class x))))
+    (if (memq t parents)
+        parents
+      `(,@parents
+        ;; FIXME: AFAICT, `comp--all-classes' will also find those struct types
+        ;; which use :type and can thus be either `vector' or `cons' (the latter
+        ;; isn't `atom').
+        atom
+        t))))
 
 (defun comp--all-classes ()
   "Return all non built-in type names currently defined."
@@ -114,7 +117,7 @@ Integer values are handled in the `range' slot.")
           for class-name in (comp--all-classes)
            for pred = (get class-name 'cl-deftype-satisfies)
            when pred
-             do (puthash pred class-name h)
+           do (puthash pred (comp--type-to-cstr class-name) h)
           finally return h))
 
 (cl-defstruct comp-cstr-ctxt