avoid an extra call to the contract-specific method for checking stronger

Before this commit, when contract-stronger? is called, it would not
be able to return #f until it calls the contract-specific stronger
method twice
This commit is contained in:
Robby Findler 2016-04-22 14:45:55 -05:00
parent 1acaf0111d
commit bbac97129e

View File

@ -152,14 +152,18 @@
((prop:recursive-contract-unroll b) b)
b)))]
[else
(let loop ([b b])
;; the 'later?' flag avoids checking
;; (stronger? a b) in the first iteration,
;; since it was checked in the "optimistically"
;; branch above
(let loop ([b b] [later? #f])
(cond
[(stronger? a b)
[(and later? (stronger? a b))
#t]
[(prop:orc-contract? b)
(define sub-contracts ((prop:orc-contract-get-subcontracts b) b))
(for/or ([sub-contract (in-list sub-contracts)])
(loop sub-contract))]
(loop sub-contract #t))]
[else
#f]))])]))