diff --git a/collects/typed-scheme/typecheck/tc-expr-unit.rkt b/collects/typed-scheme/typecheck/tc-expr-unit.rkt index 189adef4..d602751d 100644 --- a/collects/typed-scheme/typecheck/tc-expr-unit.rkt +++ b/collects/typed-scheme/typecheck/tc-expr-unit.rkt @@ -51,26 +51,19 @@ [(~var i (3d (conjoin flonum? positive?))) -PosFlonum] [(~var i (3d (conjoin flonum? negative?))) -NegFlonum] [(~var i (3d flonum?)) -Flonum] ; for nan - ;; Single flonum literals can't be assigned a type normally. - ;; Since single flonums can't live in a zo, the compilation process - ;; promotes them silently to plain flonums. Thus, a single float - ;; literal can, at runtime turn into either a single flonum (if the - ;; program is not compiled) or a plain flonum (if it is). - ;; That means that if we see a single flonum literal, we have to - ;; give it an Inexact-Real type, which covers both cases. - [(~var i (3d (lambda (x) (eq? x 0.0f0)))) -InexactRealPosZero] - [(~var i (3d (lambda (x) (eq? x -0.0f0)))) -InexactRealNegZero] - [(~var i (3d (conjoin inexact-real? positive?))) -PosInexactReal] - [(~var i (3d (conjoin inexact-real? negative?))) -NegInexactReal] - [(~var i (3d inexact-real?)) -InexactReal] ; for nan + [(~var i (3d (lambda (x) (eq? x 0.0f0)))) -SingleFlonumPosZero] + [(~var i (3d (lambda (x) (eq? x -0.0f0)))) -SingleFlonumNegZero] + [(~var i (3d (conjoin single-flonum? positive?))) -PosSingleFlonum] + [(~var i (3d (conjoin single-flonum? negative?))) -NegSingleFlonum] + [(~var i (3d single-flonum?)) -SingleFlonum] ; for nan + [(~var i (3d inexact-real?)) -InexactReal] ; catch-all, just in case [(~var i (3d real?)) -Real] ; catch-all, just in case ;; a complex number can't have a float imaginary part and an exact real part [(~var i (3d (conjoin number? (lambda (x) (and (flonum? (imag-part x)) (flonum? (real-part x))))))) -FloatComplex] - ;; same issue as single flonums - [(~var i (3d (conjoin number? (lambda (x) (and (inexact-real? (imag-part x)) - (inexact-real? (real-part x))))))) + [(~var i (3d (conjoin number? (lambda (x) (and (single-flonum? (imag-part x)) + (single-flonum? (real-part x))))))) -InexactComplex] [(~var i (3d number?)) -Number] ; otherwise, Number