Changed define-predicate to use recursive-contract. Closes PR 10939.

Closes PR11504.

original commit: 76a1112df03083098dc5aaff951d9e768e5af1b6
This commit is contained in:
Eric Dobson 2011-06-30 12:59:01 -04:00 committed by Vincent St-Amour
parent 5fb4f1af3a
commit b5c5ad7258
3 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,8 @@
#lang typed/scheme
(define-type (T elem)
(U 'other a:empty))
(define-predicate a:list? (T Any))
(define-struct: a:empty ())

View File

@ -0,0 +1,7 @@
#lang typed/racket
(define-type Animal (U cat dog))
(define-predicate animal? Animal)
(struct: cat ([lives : Natural]))
(struct: dog ([bark : Natural] [bite : Natural]))

View File

@ -40,7 +40,7 @@
#:typed-side #f
#:flat flat?
(lambda () (tc-error/stx prop "Type ~a could not be converted to a contract." typ)))])
(syntax/loc stx (define-values (n) cnt))))]
(quasisyntax/loc stx (define-values (n) (recursive-contract cnt #,(if flat? #'#:flat #'#:impersonator))))))]
[_ (int-err "should never happen - not a define-values: ~a" (syntax->datum stx))]))
(define (change-contract-fixups forms)