emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp e0f20da 14/19: Simplify correctly (or (integer 1 1)


From: Andrea Corallo
Subject: feature/native-comp e0f20da 14/19: Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t
Date: Mon, 21 Dec 2020 14:52:41 -0500 (EST)

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

    Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t
    
        * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Logic
        update.
        * test/lisp/emacs-lisp/comp-cstr-tests.el
        (comp-cstr-typespec-tests-alist): Add a test.
---
 lisp/emacs-lisp/comp-cstr.el            | 17 +++++++++++------
 test/lisp/emacs-lisp/comp-cstr-tests.el |  4 +++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index a172203..22d3958 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -474,12 +474,17 @@ DST is returned."
                     (cl-nset-difference (valset neg) (valset pos)))))
 
             ;; Range propagation
-            (setf (range neg)
-                  (when range
-                    (comp-range-negation
-                     (comp-range-union
-                      (comp-range-negation (range neg))
-                      (range pos)))))
+            (when range
+              ;; Handle apart (or (integer 1 1) (not (integer 1 1)))
+              ;; like cases.
+              (if (and (range pos) (range neg)
+                       (equal (range pos) (range neg)))
+                  (give-up)
+                (setf (range neg)
+                      (comp-range-negation
+                       (comp-range-union
+                        (comp-range-negation (range neg))
+                        (range pos))))))
 
             (if (comp-cstr-empty-p neg)
                 (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 f7ea00e..b38573c 100644
--- a/test/lisp/emacs-lisp/comp-cstr-tests.el
+++ b/test/lisp/emacs-lisp/comp-cstr-tests.el
@@ -199,7 +199,9 @@
     ;; 80
     ((and (or marker number) (integer 0 0)) . (integer 0 0))
     ;; 81
-    ((and t (not t)) . nil))
+    ((and t (not t)) . nil)
+    ;; 82
+    ((or (integer 1 1) (not (integer 1 1))) . t))
   "Alist type specifier -> expected type specifier.")
 
 (defmacro comp-cstr-synthesize-tests ()



reply via email to

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