fix stronger for ->* when there are #:pre and #:post conditions specified

This commit is contained in:
Robby Findler 2013-07-11 06:22:31 -05:00
parent 402ddcbf1e
commit ad86a72143
2 changed files with 16 additions and 1 deletions

View File

@ -43,6 +43,13 @@
(let ([c (contract-eval '(->i () () any))])
(test #t (contract-eval 'contract-stronger?) c c))
(ctest #f contract-stronger?
(->* () #:pre (zero? (random 10)) any)
(->* () #:pre (zero? (random 10)) any))
(ctest #f contract-stronger?
(->* () integer? #:post (zero? (random 10)))
(->* () integer? #:post (zero? (random 10))))
(ctest #t contract-stronger? (or/c null? any/c) (or/c null? any/c))
(ctest #f contract-stronger? (or/c null? any/c) (or/c boolean? any/c))
(ctest #t contract-stronger? (or/c null? boolean?) (or/c null? boolean?))

View File

@ -571,7 +571,15 @@
(andmap contract-stronger? (base->-optional-kwds/c that) (base->-optional-kwds/c this))
(= (length (base->-rngs/c that)) (length (base->-rngs/c this)))
(andmap contract-stronger? (base->-rngs/c this) (base->-rngs/c that))))
(andmap contract-stronger? (base->-rngs/c this) (base->-rngs/c that))
;; these procs might be based on state; only
;; allow stronger to be true when #:pre and
;; #:post aren't specified at all
(not (base->-pre this))
(not (base->-pre that))
(not (base->-post this))
(not (base->-post that))))
(define (->-generate ctc)
(let ([doms-l (length (base->-doms/c ctc))])