Fix type of - to not be wrong on negative fixnums.

This commit is contained in:
Eric Dobson 2014-02-25 09:48:15 -08:00
parent 9753aa4cf9
commit faab297ab9
2 changed files with 10 additions and 2 deletions

View File

@ -656,6 +656,13 @@
(-> -Zero neg pos)
(-> -Zero non-pos non-neg)))
;; Used because (- min-fixnum) > max-fixnum
(define (half-negation-pattern pos neg non-neg non-pos)
(list (-> pos neg)
(-> non-neg non-pos)
(-> -Zero pos neg)
(-> -Zero non-neg non-pos)))
(define abs-cases ; used both for abs and magnitude
(list
(map unop (list -Zero -One -PosByte -Byte -PosIndex -Index -PosFixnum -NonNegFixnum))
@ -1181,7 +1188,7 @@
[- (from-cases
(binop -Zero)
(negation-pattern -PosFixnum -NegFixnum -NonNegFixnum -NonPosFixnum)
(half-negation-pattern -PosFixnum -NegFixnum -NonNegFixnum -NonPosFixnum)
(negation-pattern -PosInt -NegInt -Nat -NonPosInt)
(negation-pattern -PosRat -NegRat -NonNegRat -NonPosRat)
(negation-pattern -PosFlonum -NegFlonum -NonNegFlonum -NonPosFlonum)

View File

@ -242,7 +242,8 @@
(tc-e (+ 3 4) -PosIndex)
(tc-e (- 1) -NegFixnum)
(tc-e (- 1073741823) -NegFixnum)
(tc-e (- -4) -PosFixnum)
(tc-e (- -4) -PosInt)
(tc-e (- (ann -5 Nonpositive-Fixnum)) -Nat)
(tc-e/t 1152921504606846975 -PosInt)
(tc-e/t -1152921504606846975 -NegInt)
(tc-e (- 3253463567262345623) -NegInt)