From 05259c4a238efa40fa66ac51844aa5227b9c576b Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 6 Mar 2021 20:38:00 +0100 Subject: Fix `=' propagation to handle -0.0 0.0 case * lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-homogeneous): Fix indent + use `memql'. (comp-cstr-=): Handle 0.0 -0.0 idiosyncrasy * test/src/comp-tests.el (comp-tests-type-spec-tests): Add two tests and fix enumeration. --- lisp/emacs-lisp/comp-cstr.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 6a8ec5213d5..d6423efa0d6 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -664,7 +664,7 @@ DST is returned." (cl-return-from comp-cstr-intersection-homogeneous dst)) (setf (neg dst) (when srcs - (neg (car srcs)))) + (neg (car srcs)))) ;; Type propagation. (setf (typeset dst) @@ -682,7 +682,7 @@ DST is returned." ;; If (member value) is subtypep of all other sources then ;; is good to be colleted. when (cl-every (lambda (s) - (or (memq val (valset s)) + (or (memql val (valset s)) (cl-some (lambda (type) (cl-typep val type)) (typeset s)))) @@ -890,6 +890,10 @@ Non memoized version of `comp-cstr-intersection-no-mem'." (cl-return cstr) finally (setf (valset cstr) (append vals-to-add (valset cstr)))) + (when (memql 0.0 (valset cstr)) + (cl-pushnew -0.0 (valset cstr))) + (when (memql -0.0 (valset cstr)) + (cl-pushnew 0.0 (valset cstr))) cstr)) (comp-cstr-intersection dst (relax-cstr op1) (relax-cstr op2))))) -- cgit v1.2.3