diff options
author | Andrea Corallo <akrl@sdf.org> | 2021-03-06 20:38:00 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2021-03-06 20:38:00 +0100 |
commit | 05259c4a238efa40fa66ac51844aa5227b9c576b (patch) | |
tree | e2fd7621897a67d2fcaf34c55dc65ba457fcf2bd /lisp/emacs-lisp/comp-cstr.el | |
parent | 552ef6d6c0733b864bcb14eeb6183d7e64df3b80 (diff) | |
download | emacs-05259c4a238efa40fa66ac51844aa5227b9c576b.tar.gz emacs-05259c4a238efa40fa66ac51844aa5227b9c576b.tar.bz2 emacs-05259c4a238efa40fa66ac51844aa5227b9c576b.zip |
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.
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
-rw-r--r-- | lisp/emacs-lisp/comp-cstr.el | 8 |
1 files changed, 6 insertions, 2 deletions
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))))) |