improved error checking for provide/contract struct clauses

svn: r6155

original commit: e41ff4705e6862f19a9dc034e8983be8d94ee8d2
This commit is contained in:
Robby Findler 2007-05-05 17:50:19 +00:00
parent 0612f30ec6
commit f1b5db54b7

View File

@ -5135,7 +5135,36 @@ so that propagation occurs.
(λ (x)
(and (exn? x)
(regexp-match #rx"on the-defined-variable4" (exn-message x)))))
(contract-error-test
#'(begin
(eval '(module pce5-bug mzscheme
(require (lib "contract.ss"))
(define-struct bad (a b))
(provide/contract
[struct bad ((string? a) (string? b))])))
(eval '(require pce5-bug)))
(λ (x)
(and (exn? x)
(regexp-match #rx"expected field name to be b, but found string?" (exn-message x)))))
(contract-error-test
#'(begin
(eval '(module pce6-bug mzscheme
(require (lib "contract.ss"))
(define-struct bad-parent (a))
(define-struct (bad bad-parent) (b))
(provide/contract
[struct bad ((a string?) (string? b))])))
(eval '(require pce6-bug)))
(λ (x)
(and (exn? x)
(regexp-match #rx"expected field name to be b, but found string?" (exn-message x)))))
(contract-eval `(,test 'pos guilty-party (with-handlers ((void values)) (contract not #t 'pos 'neg))))
(report-errs)