Zap a bunch more `define-contract' forms.

svn: r15971
This commit is contained in:
Mike Sperber 2009-09-11 09:38:59 +00:00
parent ed269cc43b
commit b6ca1e1673
3 changed files with 11 additions and 9 deletions

View File

@ -151,13 +151,14 @@
#'(at ?param (property ?accessor ?param)))) #'(at ?param (property ?accessor ?param))))
(syntax->list #'(our-accessor ...)) (syntax->list #'(our-accessor ...))
(syntax->list #'(?param ...))))) (syntax->list #'(?param ...)))))
#'(define-contract ?type-spec #'(define ?type-spec
(combined (at ?type-name (predicate real-predicate)) (contract
component-contract ...)))) (combined (at ?type-name (predicate real-predicate))
component-contract ...)))))
(_ (_
;; we use real-predicate to avoid infinite recursion if a contract ;; we use real-predicate to avoid infinite recursion if a contract
;; for ?type-name using ?predicate is inadvertently defined ;; for ?type-name using ?predicate is inadvertently defined
#'(define-contract ?type-name (predicate real-predicate)))))) #'(define ?type-name (contract (predicate real-predicate)))))))
(with-syntax ((defs (with-syntax ((defs
(stepper-syntax-property (stepper-syntax-property
(syntax/loc x defs) 'stepper-skip-completely #t)) (syntax/loc x defs) 'stepper-skip-completely #t))

View File

@ -141,10 +141,11 @@ Vertrag.
Aus der Datendefinition entsteht eine Vertragsdefinition folgender Form: Aus der Datendefinition entsteht eine Vertragsdefinition folgender Form:
@schemeblock[ @schemeblock[
(define-contract ctr (define ctr
(mixed #,(elem (scheme ctr) (subscript "1")) (contract
... (mixed #,(elem (scheme ctr) (subscript "1"))
#,(elem (scheme ctr) (subscript "n")))) ...
#,(elem (scheme ctr) (subscript "n")))))
] ]
Wenn die Prädikate für die einzelnen Sorten @elem[(scheme pred?) Wenn die Prädikate für die einzelnen Sorten @elem[(scheme pred?)

View File

@ -191,7 +191,7 @@
(test-case (test-case
"predicate" "predicate"
(define-contract integer (predicate integer?)) (define integer (predicate integer?))
(check-equal? (say-no (apply-contract integer 5)) 5) (check-equal? (say-no (apply-contract integer 5)) 5)
(check-equal? (say-no (apply-contract integer "foo")) 'no)) (check-equal? (say-no (apply-contract integer "foo")) 'no))