[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3eb462405e5: * lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): I
From: |
Andrea Corallo |
Subject: |
master 3eb462405e5: * lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): Improve last change. |
Date: |
Wed, 10 Apr 2024 12:50:07 -0400 (EDT) |
branch: master
commit 3eb462405e541175df99974cc06395bf191d412a
Author: Andrea Corallo <acorallo@gnu.org>
Commit: Andrea Corallo <acorallo@gnu.org>
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): Improve last change.
---
lisp/emacs-lisp/comp-cstr.el | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 5a3b7b48cc4..b13c63a2a08 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -941,16 +941,27 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
(null (neg cstr))
(equal (typeset cstr) '(cons)))))
-(define-inline comp-cstr-type-p (cstr type)
+(defun comp-cstr-type-p (cstr type)
"Return t if CSTR is certainly of type TYPE."
- (if-let ((pred (get type 'cl-deftype-satisfies)))
+ (when
(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)))
+ (cl-case type
+ (integer
+ (if (or (valset cstr) (neg cstr))
+ nil
+ (or (equal (typeset cstr) '(integer))
+ (and (range cstr)
+ (or (null (typeset cstr))
+ (equal (typeset cstr) '(integer)))))))
+ (t
+ (if-let ((pred (get type 'cl-deftype-satisfies)))
+ (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)))))
+ t))
;; Move to comp.el?
(defsubst comp-cstr-cl-tag-p (cstr)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3eb462405e5: * lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): Improve last change.,
Andrea Corallo <=