Commit bccd6a98 authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix #58: Bogus type error in comparison of complex number with `THE` form

The deftransforms `upgraded-complex-real-contagion-arg1` and
`upgraded-complex-real-contagion-arg2` were coercing the complex
number to the exact type of the float number.  Because of the `THE`
form, the type of the float was `(member 1d0)`, so the compiler was
coercing `#c(1/2 1/2)` to `(complex (double-float 1d0))`, which is

Therefore, coerce the complex to just the type format of the real
part, ignoring any bounds.

* src/compiler/float-tran.lisp
  * Coerce to format type, discarding any bounds
* src/general-info/
  * Update notes
* tests/issues.lisp
  * Added test for this
parent 31c6bf9f
Pipeline #288 passed with stage
in 9 minutes and 33 seconds
......@@ -1903,7 +1903,7 @@
(deftransform upgraded-complex-real-contagion-arg1 ((x y) * * :defun-only t :node node)
;;(format t "upgraded-complex-real-contagion-arg1~%")
`(,(continuation-function-name (basic-combination-fun node))
(coerce x '(complex ,(type-specifier (continuation-type y))))
(coerce x '(complex ,(numeric-type-format (continuation-type y))))
(deftransform upgraded-complex-real-contagion-arg2 ((x y) * * :defun-only t :node node)
......@@ -1912,7 +1912,7 @@
(continuation-type x) (continuation-type y))
`(,(continuation-function-name (basic-combination-fun node))
(coerce y '(complex ,(type-specifier (continuation-type x))))))
(coerce y '(complex ,(numeric-type-format (continuation-type x))))))
(dolist (x '(= + * / -))
......@@ -34,6 +34,7 @@ public domain.
* ~~#47~~ Backquate and multiple splices
* ~~#59~~ Incorrect type-derivation for `decode-float`
* ~~#60~~ The function `C::%UNARY-FROUND` is undefined
* ~~#58~~ Bogus type error in comparison of complex number with `THE` form
* Other changes:
* Improvements to the PCL implementation of CLOS:
* Changes to building procedure:
......@@ -515,3 +515,9 @@
(values 2d0 0d0)
(funcall c14 2d0))))
(define-test issue.58
(:tag :issues)
(let ((c9 (compile nil #'(lambda (x)
(= (the (eql 1.0d0) x) #c(1/2 1/2))))))
(assert-false (funcall c9 1.d0))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment