between/c (unlike integer-in) can actually just disappear

when the arguments are = to each other
This commit is contained in:
Robby Findler 2015-01-25 19:23:38 -06:00
parent 6551cc00d6
commit d74b0a6bf4
4 changed files with 10 additions and 2 deletions

View File

@ -177,6 +177,8 @@
(test-flat-contract '(between/c 1 10) 3 11)
(test-flat-contract '(between/c 1 10) 4 1+1i)
(test-flat-contract '(between/c 9 9) 9 10)
(test-flat-contract '(between/c 9 9) 9.0 10)
(test-flat-contract '(<=/c 1) 0 1+1i)
(test-flat-contract '(</c 1) 0 1+1i)
(test-flat-contract '(>/c 1) 4 1+1i)

View File

@ -183,7 +183,9 @@
(test-name '(>/c 5) (>/c 5))
(test-name '(between/c 5 6) (between/c 5 6))
(test-name '(between/c -inf.0 +inf.0) (between/c -inf.0 +inf.0))
(test-name '5 (between/c 5 5))
(test-name '(integer-in 0 10) (integer-in 0 10))
(test-name '(and/c 0 exact?) (integer-in 0 0))
(test-name '(real-in 1 10) (real-in 1 10))
(test-name '(between/c 1 10) (between/c 1 10))
(test-name '(string-len/c 3) (string-len/c 3))

View File

@ -441,7 +441,9 @@
(check-two-args 'between/c x y real? real?))
(define/final-prop (between/c x y)
(check-between/c x y)
(make-between/c-s x y))
(if (= x y)
(coerce-contract 'between/c x)
(make-between/c-s x y)))
(define (make-</c->/c-contract-property name </> -/+ less/greater)
(build-flat-contract-property

View File

@ -195,7 +195,9 @@
[that that])
(syntax (<= this that))))))
#:chaperone #t
#:name #''(between/c n m))))))]
#:name #'(if (= n m)
n
'(between/c n m)))))))]
[_ (opt/unknown opt/i opt/info stx)]))
(define (raise-opt-between/c-error blame val lo hi)