1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-23 20:05:32 +02:00

Fix flonum/complex type inference.

* module/language/cps/types.scm (define-binary-result!): Arithmetic
  where one argument is a flonum may produce a complex.
* test-suite/tests/compiler.test: Add test.
This commit is contained in:
Andy Wingo 2017-02-19 11:56:24 +01:00
parent c58c143f31
commit d0811644f6
2 changed files with 18 additions and 2 deletions

View file

@ -239,3 +239,15 @@
(begin
(test-proc)
#t)))
(with-test-prefix "flonum inference"
(define test-code
'(lambda (x) (let ((y (if x 0.0 0.0+0.0i))) (+ y 0.0))))
(define test-proc #f)
(pass-if "compiling test works"
(begin
(set! test-proc (compile test-code))
(procedure? test-proc)))
(pass-if-equal "test flonum" 0.0 (test-proc #t))
(pass-if-equal "test complex" 0.0+0.0i (test-proc #f)))