aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2024-04-10 18:15:12 +0200
committerAndrea Corallo2024-04-10 18:16:26 +0200
commitee03a73375796feea94bb066cff7d7de680cae32 (patch)
tree31cc18db214124cabaf7ba39d99e51b12a096df7
parentd4d8575bf00bb722bbb913fa5aa5b68c6dbef4d3 (diff)
downloademacs-ee03a73375796feea94bb066cff7d7de680cae32.tar.gz
emacs-ee03a73375796feea94bb066cff7d7de680cae32.zip
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): New function.
-rw-r--r--lisp/emacs-lisp/comp-cstr.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 73d445eb3f4..5a3b7b48cc4 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -941,6 +941,17 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
941 (null (neg cstr)) 941 (null (neg cstr))
942 (equal (typeset cstr) '(cons))))) 942 (equal (typeset cstr) '(cons)))))
943 943
944(define-inline comp-cstr-type-p (cstr type)
945 "Return t if CSTR is certainly of type TYPE."
946 (if-let ((pred (get type 'cl-deftype-satisfies)))
947 (with-comp-cstr-accessors
948 (and (null (range cstr))
949 (null (neg cstr))
950 (and (or (null (typeset cstr))
951 (equal (typeset cstr) `(,type)))
952 (cl-every pred (valset cstr)))))
953 (error "Unknown predicate for type %s" type)))
954
944;; Move to comp.el? 955;; Move to comp.el?
945(defsubst comp-cstr-cl-tag-p (cstr) 956(defsubst comp-cstr-cl-tag-p (cstr)
946 "Return non-nil if CSTR is a CL tag." 957 "Return non-nil if CSTR is a CL tag."