Make generated flat contracts actually flat.

original commit: 3876dfa8411e06b2225b614246fa0274855e915b
This commit is contained in:
Eric Dobson 2012-08-08 22:00:56 -07:00 committed by Sam Tobin-Hochstadt
parent 7acddd1b92
commit da8782fb09
2 changed files with 6 additions and 2 deletions

View File

@ -3,3 +3,7 @@
(define-predicate int-or-bool? (U Integer Boolean))
(int-or-bool? 7)
(define-predicate int-list? (Rec List (Pair Integer (U '() List))))
(int-list? 1)
(int-list? '(1 2 3))

View File

@ -217,7 +217,7 @@
(match-let ([(Mu-name: n-nm _) ty])
(with-syntax ([(n*) (generate-temporaries (list n-nm))])
(parameterize ([vars (cons (list n #'n* #'n*) (vars))])
#`(letrec ([n* (recursive-contract #,(t->c b))])
#`(letrec ([n* (recursive-contract #,(t->c b) #,(if flat? #'#:flat #'#:impersonator))])
n*))))]
[(Value: #f) #'false/c]
[(Instance: (Class: _ _ (list (list name fcn) ...)))
@ -258,7 +258,7 @@
(#,pred? val)
#,@(for/list ([fty flds] [f-acc acc-ids])
#`((flat-contract-predicate
#,(t->c fty #:seen (cons (cons ty #'(recursive-contract rec)) structs-seen)))
#,(t->c fty #:seen (cons (cons ty #'(recursive-contract rec #:flat)) structs-seen)))
(#,f-acc val))))))])
rec)
;Should make this case a chaperone/impersonator contract