emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 8e816b0 11/19: Symplify type specifier (not t) as ni


From: Andrea Corallo
Subject: feature/native-comp 8e816b0 11/19: Symplify type specifier (not t) as nil
Date: Mon, 21 Dec 2020 14:52:40 -0500 (EST)

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

    Symplify type specifier (not t) as nil
    
        * lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-no-mem):
        Add logic.
        * test/lisp/emacs-lisp/comp-cstr-tests.el
        (comp-cstr-typespec-tests-alist): Add two tests.
---
 lisp/emacs-lisp/comp-cstr.el            | 9 +++++++++
 test/lisp/emacs-lisp/comp-cstr-tests.el | 6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 3f3f4f6..cd8f432 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -598,6 +598,15 @@ DST is returned."
                   (valset dst) (valset neg)
                   (range dst) (range neg)
                   (neg dst) t)
+
+            ;; (not t) => nil
+            (when (and (null (valset dst))
+                       (null (range dst))
+                       (neg dst)
+                       (equal '(t) (typeset dst)))
+              (setf (typeset dst) ()
+                    (neg dst) nil))
+
             (cl-return-from comp-cstr-intersection-no-mem dst))
 
           (when (cl-some
diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el 
b/test/lisp/emacs-lisp/comp-cstr-tests.el
index 03bf789..f7ea00e 100644
--- a/test/lisp/emacs-lisp/comp-cstr-tests.el
+++ b/test/lisp/emacs-lisp/comp-cstr-tests.el
@@ -195,7 +195,11 @@
     ;; 77
     ((and (or symbol string) (or number marker)) . nil)
     ;; 78
-    ((and t t) . t))
+    ((and t t) . t)
+    ;; 80
+    ((and (or marker number) (integer 0 0)) . (integer 0 0))
+    ;; 81
+    ((and t (not t)) . nil))
   "Alist type specifier -> expected type specifier.")
 
 (defmacro comp-cstr-synthesize-tests ()



reply via email to

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