* lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): New function.
This commit is contained in:
parent
d4d8575bf0
commit
ee03a73375
1 changed files with 11 additions and 0 deletions
|
@ -941,6 +941,17 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
|
|||
(null (neg cstr))
|
||||
(equal (typeset cstr) '(cons)))))
|
||||
|
||||
(define-inline comp-cstr-type-p (cstr type)
|
||||
"Return t if CSTR is certainly of type TYPE."
|
||||
(if-let ((pred (get type 'cl-deftype-satisfies)))
|
||||
(with-comp-cstr-accessors
|
||||
(and (null (range cstr))
|
||||
(null (neg cstr))
|
||||
(and (or (null (typeset cstr))
|
||||
(equal (typeset cstr) `(,type)))
|
||||
(cl-every pred (valset cstr)))))
|
||||
(error "Unknown predicate for type %s" type)))
|
||||
|
||||
;; Move to comp.el?
|
||||
(defsubst comp-cstr-cl-tag-p (cstr)
|
||||
"Return non-nil if CSTR is a CL tag."
|
||||
|
|
Loading…
Add table
Reference in a new issue