From e7e187e1de37820f54e8a158c897db33ba6e9e20 Mon Sep 17 00:00:00 2001 From: Stevie Strickland Date: Thu, 13 May 2010 15:43:52 -0400 Subject: [PATCH] Now change box/c to use proxies or chaperones appropriately. Create a mzlib/contract compatible version of the old box/c and use that for mzlib/contract. Change the docs so that the docs for mzlib/contract contain the right information. Fix the typed-scheme implementation to only force flat box (or hash) contracts when it already is required to be flat. Otherwise, allow non-flat contracts for the element contract (or domain/range contracts). original commit: 994ad6d10fc817a5ceca2f9f4874dac5c14c0aab --- collects/typed-scheme/private/type-contract.rkt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/collects/typed-scheme/private/type-contract.rkt b/collects/typed-scheme/private/type-contract.rkt index dd59522a..5c4b9278 100644 --- a/collects/typed-scheme/private/type-contract.rkt +++ b/collects/typed-scheme/private/type-contract.rkt @@ -134,7 +134,9 @@ [(Vector: t) #`(vectorof #,(t->c t #:flat #t))] [(Box: t) - #`(box/c #,(t->c t #:flat #t))] + (if flat? + #`(box/c #,(t->c t #:flat #t) #:flat? #t) + #`(box/c #,(t->c t)))] [(Pair: t1 t2) #`(cons/c #,(t->c t1) #,(t->c t2))] [(Opaque: p? cert) @@ -206,7 +208,10 @@ [(Syntax: t) #`(syntax/c #,(t->c t))] [(Value: v) #`(flat-named-contract #,(format "~a" v) (lambda (x) (equal? x '#,v)))] [(Param: in out) #`(parameter/c #,(t->c out))] - [(Hashtable: k v) #`(hash/c #,(t->c k #:flat #t) #,(t->c v #:flat #t) #:immutable 'dont-care)] + [(Hashtable: k v) + (if flat? + #`(hash/c #,(t->c k #:flat #t) #,(t->c v #:flat #t) #:flat? #t #:immutable 'dont-care) + #`(hash/c #,(t->c k) #,(t->c v) #:immutable 'dont-care))] [else (exit (fail))]))))