diff --git a/collects/mzlib/private/contract-ds.ss b/collects/mzlib/private/contract-ds.ss index 2d46fa1764..5371e9c0c6 100644 --- a/collects/mzlib/private/contract-ds.ss +++ b/collects/mzlib/private/contract-ds.ss @@ -58,7 +58,7 @@ it around flattened out. #f #t stx)] - [struct:-name (list-ref struct-names 0)] + [struct:-name/val (list-ref struct-names 0)] [struct-maker/val (list-ref struct-names 1)] [predicate/val (list-ref struct-names 2)] [selectors/val (cdddr struct-names)] @@ -72,6 +72,7 @@ it around flattened out. [struct/dc struct/dc-name/val] [field-count field-count/val] [(selectors ...) selectors/val] + [struct:-name struct:-name/val] [struct-maker struct-maker/val] [predicate predicate/val] [contract-name (add-suffix "-contract")] @@ -94,6 +95,13 @@ it around flattened out. (values)))) (list)) + (define-syntax name (list-immutable #'struct:-name + #'struct-maker + #'predicate + (list-immutable #'selectors ...) + (list-immutable #,@(map (λ (x) #f) (syntax->list #'(selectors ...)))) + #t)) + (define (evaluate-attrs stct contract/info) (when (wrap-parent-get stct 0) ;; test to make sure this even has attributes (let* ([any-unknown? #f] diff --git a/collects/tests/mzscheme/contract-test.ss b/collects/tests/mzscheme/contract-test.ss index cb1da99e32..7d41af03e9 100644 --- a/collects/tests/mzscheme/contract-test.ss +++ b/collects/tests/mzscheme/contract-test.ss @@ -3399,13 +3399,28 @@ (contract-eval '(define-contract-struct couple (hd tl))) + (test/spec-passed + 'd-c-s-match1 + '(begin + (eval '(module d-c-s-match1 mzscheme + (require (lib "contract.ss") + (lib "match.ss")) + + (define-contract-struct foo (bar baz)) + + (match (make-foo #t #f) + [($ foo bar baz) #t] + [_ #f]))) + (eval '(require d-c-s-match1)))) + + (test/pos-blame 'd-c-s1 '(begin - (eval '(module m mzscheme + (eval '(module d-c-s1 mzscheme (require (lib "contract.ss")) (define-contract-struct couple (hd tl)) (contract (couple/c any/c any/c) 1 'pos 'neg))) - (eval '(require m)))) + (eval '(require d-c-s1)))) (test/spec-passed 'd-c-s2 '(contract (couple/c any/c any/c) (make-couple 1 2) 'pos 'neg))