From: Andrea Corallo Date: Thu, 17 Dec 2020 17:01:10 +0000 (+0100) Subject: Symplify type specifier (not t) as nil X-Git-Tag: emacs-28.0.90~2727^2~244 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8e816b0ad574a279b12a4d6622c6f224b67083b8;p=emacs.git 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. --- diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 3f3f4f61451..cd8f432412c 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 03bf78968f2..f7ea00e86f2 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 ()