fix error message in ->i

in the case where the dependened on contract is a first-order contract, there
is a shortcircuit that incorrectly formulated the error message
This commit is contained in:
Robby Findler 2016-03-09 15:37:52 -06:00
parent 11927aea37
commit 041cebc9c0
2 changed files with 20 additions and 2 deletions
pkgs/racket-test/tests/racket/contract
racket/collects/racket/contract/private

View File

@ -1440,4 +1440,22 @@
(λ (x y) x)
'pos 'neg) 1 2)
"didn't raise an error")
#t))
#t)
(test/spec-passed/result
'shortcut-error-message
'(with-handlers ([exn:fail?
(λ (x) (define m
(regexp-match #rx"expected: ([^\n]*)\n"
(exn-message x)))
(if m
(list-ref m 1)
(format "ack regexp didn't match: ~s"
(exn-message x))))])
((contract (->i ([y () (and/c number? (>/c 1))]) any)
(λ (y) 1)
'pos 'neg)
1))
"(and/c number? (>/c 1))")
)

View File

@ -1090,7 +1090,7 @@ evaluted left-to-right.)
(if (orig-ctc obj)
obj
(raise-predicate-blame-error-failure blame obj neg-party
(object-name orig-ctc)))]
(contract-name orig-ctc)))]
[else
(define ctc (if chaperone?
(coerce-chaperone-contract '->i orig-ctc)