diff --git a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt index d29dbc6e..e234ed7f 100644 --- a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -215,6 +215,7 @@ (tc-e (min (ann 3 Fixnum) (ann 3 Fixnum)) -Fixnum) (tc-e (min (ann -2 Negative-Fixnum) (ann 3 Fixnum)) -NegFixnum) (tc-e (min (ann 3 Fixnum) (ann -2 Negative-Fixnum)) -NegFixnum) + (tc-e (exact->inexact (ann 3 Number)) (t:Un -InexactReal -InexactComplex)) [tc-e/t (lambda: () 3) (t:-> -PosByte : -true-lfilter)] [tc-e/t (lambda: ([x : Number]) 3) (t:-> N -PosByte : -true-lfilter)] diff --git a/collects/typed-racket/base-env/base-env-numeric.rkt b/collects/typed-racket/base-env/base-env-numeric.rkt index 5e12031d..ecc512e5 100644 --- a/collects/typed-racket/base-env/base-env-numeric.rkt +++ b/collects/typed-racket/base-env/base-env-numeric.rkt @@ -697,8 +697,11 @@ [complex? (make-pred-ty N)] ;; `rational?' includes all Reals, except infinities and NaN. [rational? (asym-pred Univ B (-FS (-filter -Real 0) (-not-filter -Rat 0)))] -[exact? (asym-pred N B (-FS -top (-not-filter -Rat 0)))] -[inexact? (asym-pred N B (-FS -top (-not-filter (Un -InexactReal -FloatComplex) 0)))] +[exact? (asym-pred N B (-FS -top (-not-filter -ExactNumber 0)))] +;; `inexact?' can't be a predicate for `(Un -InexactReal -InexactComplex)' because it +;; returns #t on things like 0+1.2i, which are not -InexactComplex (`real-part' of it +;; is exact 0) +[inexact? (asym-pred N B (-FS -top (-not-filter (Un -InexactReal -InexactComplex) 0)))] [fixnum? (make-pred-ty -Fixnum)] [index? (make-pred-ty -Index)] [positive? (cl->* (-> -Byte B : (-FS (-filter -PosByte 0) (-filter -Zero 0))) @@ -1501,7 +1504,7 @@ (-FloatComplex . -> . -FloatComplex) (-SingleFlonumComplex . -> . -SingleFlonumComplex) (-InexactComplex . -> . -InexactComplex) - (N . -> . N))] + (N . -> . (Un -InexactReal -InexactComplex)))] [inexact->exact (from-cases (map unop all-rat-types) (-RealZero . -> . -Zero)