From: Andrea Corallo Date: Tue, 27 Apr 2021 20:43:12 +0000 (+0200) Subject: Have `comp-cstr-intersection-no-mem' intersect pos neg value sets X-Git-Tag: emacs-28.0.90~2685 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4e1e0b9decfa2c8cb90b91d619ca078412513ba5;p=emacs.git Have `comp-cstr-intersection-no-mem' intersect pos neg value sets * lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-no-mem): intersect pos and neg value sets * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add two tests and fix some test number. --- diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 2a50ceb194f..73b78a3672d 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -790,7 +790,9 @@ Non memoized version of `comp-cstr-intersection-no-mem'." (setf (range pos) (comp-range-intersection (range pos) - (comp-range-negation (range neg)))) + (comp-range-negation (range neg))) + (valset pos) + (cl-set-difference (valset pos) (valset neg))) ;; Return a non negated form. (setf (typeset dst) (typeset pos) diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el b/test/lisp/emacs-lisp/comp-cstr-tests.el index 2e4628522f4..59e1b6982e1 100644 --- a/test/lisp/emacs-lisp/comp-cstr-tests.el +++ b/test/lisp/emacs-lisp/comp-cstr-tests.el @@ -198,22 +198,26 @@ ((and (or symbol string) (or number marker)) . nil) ;; 78 ((and t t) . t) - ;; 80 + ;; 79 ((and (or marker number) (integer 0 0)) . (integer 0 0)) - ;; 81 + ;; 80 ((and t (not t)) . nil) - ;; 82 + ;; 81 ((or (integer 1 1) (not (integer 1 1))) . t) - ;; 83 + ;; 82 ((not t) . nil) - ;; 84 + ;; 83 ((not nil) . t) - ;; 85 + ;; 84 ((or (not string) t) . t) - ;; 86 + ;; 85 ((or (not vector) sequence) . sequence) + ;; 86 + ((or (not symbol) null) . t) ;; 87 - ((or (not symbol) null) . t)) + ((and (or null integer) (not (or null integer))) . nil) + ;; 88 + ((and (or (member a b c)) (not (or (member a b)))) . (member c))) "Alist type specifier -> expected type specifier.")) (defmacro comp-cstr-synthesize-tests ()