From: Andrea Corallo Date: Mon, 22 Feb 2021 12:58:30 +0000 (+0100) Subject: * Fix union constraint for mixed pos/neg constraints X-Git-Tag: emacs-28.0.90~2727^2~135 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d6227f6edcff7be05469e99da4ce541bfc474c3d;p=emacs.git * Fix union constraint for mixed pos/neg constraints * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Fix neg type shadowing pos values. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add testcase. * test/src/comp-tests.el (comp-tests-type-spec-tests): Fix testcase. --- diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 3c00b68d0f6..c294c53b6b0 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -597,6 +597,12 @@ DST is returned." (valset pos))) ;; Pos is a superset of neg. (give-up)) + ((cl-some (lambda (x) + (cl-some (lambda (y) + (comp-subtype-p y x)) + (mapcar #'type-of (valset pos)))) + (typeset neg)) + (give-up)) (t ;; pos is a subset or eq to neg (setf (valset neg) diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el b/test/lisp/emacs-lisp/comp-cstr-tests.el index b4db54666c7..f2d9bf583e5 100644 --- a/test/lisp/emacs-lisp/comp-cstr-tests.el +++ b/test/lisp/emacs-lisp/comp-cstr-tests.el @@ -211,7 +211,9 @@ ;; 85 ((or (not string) t) . t) ;; 86 - ((or (not vector) sequence) . sequence)) + ((or (not vector) sequence) . sequence) + ;; 87 + ((or (not symbol) null) . t)) "Alist type specifier -> expected type specifier.")) (defmacro comp-cstr-synthesize-tests () diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 08c18894419..f7b5a6bbb4c 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -1185,7 +1185,7 @@ Return a list of results." ((defun comp-tests-ret-type-spec-f (x) (unless (symbolp x) x)) - (not symbol)) + t) ;; 55 ((defun comp-tests-ret-type-spec-f (x)