diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt index a3d0e9b29b..5325d80486 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt @@ -255,6 +255,7 @@ (unsafe-fl* c.imag-binding c.imag-binding)))))) (pattern (#%plain-app op:exp^ c:unboxed-float-complex-opt-expr) + #:when (subtypeof? this-syntax -FloatComplex) #:with (real-binding imag-binding) (binding-names) #:with scaling-factor (generate-temporary "unboxed-scaling-") #:do [(log-unboxing-opt "unboxed unary float complex")] @@ -286,12 +287,14 @@ ;; we can eliminate boxing that was introduced by the user (pattern (#%plain-app op:make-rectangular^ real:float-arg-expr imag:float-arg-expr) + #:when (subtypeof? this-syntax -FloatComplex) #:with (real-binding imag-binding) (binding-names) #:do [(log-unboxing-opt "make-rectangular elimination")] #:with (bindings ...) #'(((real-binding) real.opt) ((imag-binding) imag.opt))) (pattern (#%plain-app op:make-polar^ r:float-arg-expr theta:float-arg-expr) + #:when (subtypeof? this-syntax -FloatComplex) #:with radius (generate-temporary) #:with angle (generate-temporary) #:with (real-binding imag-binding) (binding-names) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/optimizer/tests/complex-exp.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/optimizer/tests/complex-exp.rkt index 9eff1ab552..b555f85e82 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/optimizer/tests/complex-exp.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/optimizer/tests/complex-exp.rkt @@ -2,7 +2,7 @@ #<