diff --git a/collects/tests/typed-racket/optimizer/tests/expt.rkt b/collects/tests/typed-racket/optimizer/tests/expt.rkt new file mode 100644 index 00000000..1cf3b12f --- /dev/null +++ b/collects/tests/typed-racket/optimizer/tests/expt.rkt @@ -0,0 +1,13 @@ +#; +( +TR missed opt: expt.rkt 13:13 (expt (sin 0.25) 1.0) -- unexpected complex type +TR opt: expt.rkt 13:19 (sin 0.25) -- unary float +) + +#lang typed/racket + +;; PR 12526 +;; result of expt was Float-Complex, and shouldn't have been +;; this let to incorrect optimization +(define (crash) + (real-part (expt (sin 0.25) 1.0))) diff --git a/collects/typed-racket/base-env/base-env-numeric.rkt b/collects/typed-racket/base-env/base-env-numeric.rkt index 6cd8b04f..a9315742 100644 --- a/collects/typed-racket/base-env/base-env-numeric.rkt +++ b/collects/typed-racket/base-env/base-env-numeric.rkt @@ -1594,11 +1594,11 @@ (-PosReal -Real . -> . -PosReal) (-NonNegReal -Real . -> . -NonNegReal) (-Flonum -Integer . -> . -Flonum) - (-Flonum -Real . -> . -FloatComplex) + (-Flonum -Real . -> . N) (-SingleFlonum -Integer . -> . -SingleFlonum) - (-SingleFlonum -SingleFlonum . -> . -SingleFlonumComplex) + (-SingleFlonum -SingleFlonum . -> . (Un -SingleFlonum -SingleFlonumComplex)) (-InexactReal -Integer . -> . -InexactReal) - (-InexactReal -InexactReal . -> . -InexactComplex) + (-InexactReal -InexactReal . -> . (Un -InexactReal -InexactComplex)) (-ExactNumber -ExactNumber . -> . -ExactNumber) (commutative-binop N -FloatComplex) (commutative-binop (Un -ExactNumber -SingleFlonum -SingleFlonumComplex) -SingleFlonumComplex)