From: Andrea Corallo Date: Wed, 2 Dec 2020 22:49:00 +0000 (+0100) Subject: Fix union of homogeneously negated input constraints X-Git-Tag: emacs-28.0.90~2727^2~285 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=726e40fb7c0eb50e6afe831997da445c32872eed;p=emacs.git Fix union of homogeneously negated input constraints * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1): Fix logic. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a couple of tests. --- diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 96aa67ec9d7..3aad3dc2c24 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -325,6 +325,8 @@ DST is returned." finally (when (or (zerop n-pos) (zerop n-neg)) (apply #'comp-cstr-union-homogeneous dst srcs) + (when (zerop n-pos) + (setf (neg dst) t)) (cl-return-from comp-cstr-union-1 dst))) ;; Some are negated and some are not diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el b/test/lisp/emacs-lisp/comp-cstr-tests.el index 5c119c6ba3e..0b10b7f80a1 100644 --- a/test/lisp/emacs-lisp/comp-cstr-tests.el +++ b/test/lisp/emacs-lisp/comp-cstr-tests.el @@ -85,7 +85,9 @@ ((or symbol (not sequence)) . t) ((or vector (not sequence)) . (not sequence)) ((or (integer 1 10) (not (integer * 5))) . (integer 1 *)) - ((or symbol (integer 1 10) (not (integer * 5))) . (integer 1 *))) + ((or symbol (integer 1 10) (not (integer * 5))) . (integer 1 *)) + ((or symbol (not (member foo))) . (not (member foo))) + ((or (not symbol) (not (member foo))) . (not symbol))) "Alist type specifier -> expected type specifier.") (defmacro comp-cstr-synthesize-tests ()