Fixed a bug in typed Scheme's optimizer when using binary arithmetic
operators in a unary fashion with floats.
This commit is contained in:
parent
664ef2c0a3
commit
762f108c04
|
@ -60,11 +60,11 @@
|
||||||
(begin (log-optimization "unary float" #'op)
|
(begin (log-optimization "unary float" #'op)
|
||||||
#'(op.unsafe f.opt)))
|
#'(op.unsafe f.opt)))
|
||||||
;; unlike their safe counterparts, unsafe binary operators can only take 2 arguments
|
;; unlike their safe counterparts, unsafe binary operators can only take 2 arguments
|
||||||
(pattern (#%plain-app op:float-binary-op f fs ...)
|
(pattern (#%plain-app op:float-binary-op f1 f2 fs ...)
|
||||||
#:with opt
|
#:with opt
|
||||||
(begin (log-optimization "binary float" #'op)
|
(begin (log-optimization "binary float" #'op)
|
||||||
(for/fold ([o #'f.opt])
|
(for/fold ([o #'f1.opt])
|
||||||
([e (syntax->list #'(fs.opt ...))])
|
([e (syntax->list #'(f2.opt fs.opt ...))])
|
||||||
#`(op.unsafe #,o #,e))))
|
#`(op.unsafe #,o #,e))))
|
||||||
(pattern (#%plain-app op:pair-unary-op p)
|
(pattern (#%plain-app op:pair-unary-op p)
|
||||||
#:with opt
|
#:with opt
|
||||||
|
@ -99,10 +99,10 @@
|
||||||
#:exists 'append)
|
#:exists 'append)
|
||||||
(current-output-port))))
|
(current-output-port))))
|
||||||
(begin0
|
(begin0
|
||||||
(parameterize ([current-output-port port])
|
(parameterize ([current-output-port port])
|
||||||
(syntax-parse stx #:literal-sets (kernel-literals)
|
(syntax-parse stx #:literal-sets (kernel-literals)
|
||||||
[e:opt-expr
|
[e:opt-expr
|
||||||
(syntax/loc stx e.opt)]))
|
(syntax/loc stx e.opt)]))
|
||||||
(if (and *log-optimizations?*
|
(if (and *log-optimizations?*
|
||||||
*log-optimizatons-to-log-file?*)
|
*log-optimizatons-to-log-file?*)
|
||||||
(close-output-port port)
|
(close-output-port port)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user