Added special case to the typechecker for (- <positive-fixnum> 1).

This commit is contained in:
Vincent St-Amour 2010-06-28 16:03:04 -04:00
parent f27aac552f
commit c6373ca7c0

View File

@ -608,7 +608,8 @@
[(#%plain-app (~and op (~literal -)) v (~and arg2 ((~literal quote) 1)))
(add-typeof-expr #'arg2 (ret -PositiveFixnum))
(match-let ([(tc-result1: t) (single-value #'v)])
(cond
(cond
[(subtype t -PositiveFixnum) (ret (Un -Zero -PositiveFixnum))]
[(subtype t (Un -Zero -PositiveFixnum)) (ret -Fixnum)]
[(subtype t -ExactPositiveInteger) (ret -Nat)]
[else (tc/funapp #'op #'(v arg2) (single-value #'op) (list (ret t) (single-value #'arg2)) expected)]))]