From 8e816b0ad574a279b12a4d6622c6f224b67083b8 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 17 Dec 2020 18:01:10 +0100 Subject: 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 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lisp/emacs-lisp') 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 -- cgit v1.2.3