From 057a2bd0d2d1c9bc2085eab3817b776aa66dfa19 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Mon, 7 Jan 2013 15:19:21 -0500 Subject: [PATCH] Extend type of min to preserve fixnumness. --- collects/tests/typed-racket/unit-tests/typecheck-tests.rkt | 3 +++ collects/typed-racket/base-env/base-env-numeric.rkt | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt index 390b9d8195..d73eea1035 100644 --- a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -212,6 +212,9 @@ (tc-e (angle 2.3) -Zero) (tc-e (magnitude 3/4) -NonNegRat) (tc-e (magnitude 3+2i) -NonNegReal) + (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/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 8d941ddab3..0cf1f4ed5a 100644 --- a/collects/typed-racket/base-env/base-env-numeric.rkt +++ b/collects/typed-racket/base-env/base-env-numeric.rkt @@ -1251,7 +1251,10 @@ [min (from-cases (map varop (list -Zero -One)) (commutative-case -Zero -One) - (map varop (list -PosByte -Byte -PosIndex -Index -PosInt -Nat)) + (map varop (list -PosByte -Byte -PosIndex -Index -PosFixnum -NonNegFixnum)) + (commutative-case -NegFixnum -Fixnum) + (commutative-case -NonPosFixnum -Fixnum) + (map varop (list -Fixnum -PosInt -Nat)) (commutative-case -NegInt -Int) (commutative-case -NonPosInt -Int) (map varop (list -Int -PosRat -NonNegRat))