emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 726e40f 5/8: Fix union of homogeneously negated inpu


From: Andrea Corallo
Subject: feature/native-comp 726e40f 5/8: Fix union of homogeneously negated input constraints
Date: Sat, 5 Dec 2020 17:07:33 -0500 (EST)

branch: feature/native-comp
commit 726e40fb7c0eb50e6afe831997da445c32872eed
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    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.
---
 lisp/emacs-lisp/comp-cstr.el            | 2 ++
 test/lisp/emacs-lisp/comp-cstr-tests.el | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 96aa67e..3aad3dc 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 5c119c6..0b10b7f 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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]