summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-12-22 20:39:24 +0100
committerAndrea Corallo <akrl@sdf.org>2020-12-24 15:36:46 +0100
commit672988e961744750d3ea40904807355336116c3f (patch)
treeb5cc51a039007ed47dfd078e99740a68abd7d8fd /lisp/emacs-lisp
parent538f59806c1994df7d77716f896db5602f59dc02 (diff)
downloademacs-672988e961744750d3ea40904807355336116c3f.tar.gz
emacs-672988e961744750d3ea40904807355336116c3f.tar.bz2
emacs-672988e961744750d3ea40904807355336116c3f.zip
Symplify (not t) => nil and (not nil) => t
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-negation): Symplify (not t) => nil and (not nil) => t. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add two tests.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp-cstr.el25
1 files changed, 21 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 8b5639c8a4d..19905950b5a 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -695,10 +695,27 @@ DST is returned."
"Negate SRC setting the result in DST.
DST is returned."
(with-comp-cstr-accessors
- (setf (typeset dst) (typeset src)
- (valset dst) (valset src)
- (range dst) (range src)
- (neg dst) (not (neg src)))
+ (cond
+ ((and (null (valset src))
+ (null (range src))
+ (null (neg src))
+ (equal (typeset src) '(t)))
+ (setf (typeset dst) ()
+ (valset dst) ()
+ (range dst) nil
+ (neg dst) nil))
+ ((and (null (valset src))
+ (null (range src))
+ (null (neg src))
+ (null (typeset src)))
+ (setf (typeset dst) '(t)
+ (valset dst) ()
+ (range dst) nil
+ (neg dst) nil))
+ (t (setf (typeset dst) (typeset src)
+ (valset dst) (valset src)
+ (range dst) (range src)
+ (neg dst) (not (neg src)))))
dst))
(defun comp-cstr-value-negation (dst src)