First attempt at logging unexpected Real types popping up.
original commit: 7b2c6f5765c2f3b5aefd24f15bbd6f9bf5855749
This commit is contained in:
parent
a2400d8d4b
commit
69b3ea5f28
|
@ -0,0 +1,14 @@
|
|||
#;
|
||||
(
|
||||
real-in-float-expr.rkt line 10 col 0 - (#%app * (quote 3) (quote 2.3)) - binary, args all float-arg-expr, return type not Float
|
||||
6.8999999999999995
|
||||
6
|
||||
5
|
||||
)
|
||||
#lang typed/racket
|
||||
|
||||
(* (ann 3 Real) ; with type Real, typechecker must assume it could be exact 0
|
||||
2.3)
|
||||
|
||||
(* (ann 2 Integer) (ann 3 Integer)) ; but these have nothing to do with floats, should not be logged
|
||||
(+ (ann 2 Integer) (ann 3 Integer))
|
|
@ -86,7 +86,14 @@
|
|||
f2:float-arg-expr
|
||||
fs:float-arg-expr ...)
|
||||
;; if the result is a float, we can coerce integers to floats and optimize
|
||||
#:when (subtypeof? this-syntax -Flonum)
|
||||
#:when (let ([safe-to-opt? (subtypeof? this-syntax -Flonum)])
|
||||
;; if we don't have a return type of float, we missed an optimization
|
||||
;; opportunity, report it
|
||||
(when (and (not safe-to-opt?)
|
||||
(isoftype? this-syntax -Real))
|
||||
(log-close-call "binary, args all float-arg-expr, return type not Float"
|
||||
this-syntax))
|
||||
safe-to-opt?)
|
||||
#:with opt
|
||||
(begin (log-optimization "binary float" #'op)
|
||||
(n-ary->binary #'op.unsafe #'f1.opt #'f2.opt #'(fs.opt ...))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user