[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 ()
- feature/native-comp updated (eb8d155 -> 09ec39e), Andrea Corallo, 2020/12/05
- feature/native-comp 9b85ae6 1/8: Initial constraint negation support, Andrea Corallo, 2020/12/05
- feature/native-comp 7c1d90a 3/8: Initial support for union of negated constraints, Andrea Corallo, 2020/12/05
- feature/native-comp 726e40f 5/8: Fix union of homogeneously negated input constraints,
Andrea Corallo <=
- feature/native-comp f923de6 6/8: * Fix `comp-cstr-to-type-spec', Andrea Corallo, 2020/12/05
- feature/native-comp 09ec39e 8/8: * Memoize `comp-cstr-union-1', Andrea Corallo, 2020/12/05
- feature/native-comp 1fb249f 2/8: * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-no-range): Cosmetic., Andrea Corallo, 2020/12/05
- feature/native-comp cbbdb4e 4/8: * Add `with-comp-cstr-accessors' macro., Andrea Corallo, 2020/12/05
- feature/native-comp 2eb41ec 7/8: More improvements to `comp-cstr-union-1' for mixed positive/negative cases, Andrea Corallo, 2020/12/05