From 5733f06d9aa0134e9f451d5a30a6583793de1be8 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Fri, 1 Oct 2010 19:20:05 -0700 Subject: [PATCH] Contract fixes. original commit: c739128703d917540ff963775459b6c75ccf2c80 --- collects/typed-scheme/typecheck/tc-envops.rkt | 6 ++++-- collects/typed-scheme/types/substitute.rkt | 17 ++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/collects/typed-scheme/typecheck/tc-envops.rkt b/collects/typed-scheme/typecheck/tc-envops.rkt index 8643a6b3..de799dc4 100644 --- a/collects/typed-scheme/typecheck/tc-envops.rkt +++ b/collects/typed-scheme/typecheck/tc-envops.rkt @@ -72,7 +72,8 @@ ;; sets the flag box to #f if anything becomes (U) (d/c (env+ env fs flag) - (env? (listof Filter/c) (box/c #t). -> . env?) + (([e env?] [fs (listof Filter/c)] [bx (box/c boolean?)]) + #:pre (bx) (unbox bx) . ->i . [_ env?]) (define-values (props atoms) (combine-props fs (env-props env) flag)) (for/fold ([Γ (replace-props env (append atoms props))]) ([f atoms]) (match f @@ -85,4 +86,5 @@ x Γ)] [_ Γ]))) -(p/c [env+ (env? (listof Filter/c) (box/c #t). -> . env?)]) \ No newline at end of file +(p/c [env+ (([e env?] [fs (listof Filter/c)] [bx (box/c boolean?)]) + #:pre (bx) (unbox bx) . ->i . [_ env?])]) diff --git a/collects/typed-scheme/types/substitute.rkt b/collects/typed-scheme/types/substitute.rkt index 60850e27..e5fcc5ab 100644 --- a/collects/typed-scheme/types/substitute.rkt +++ b/collects/typed-scheme/types/substitute.rkt @@ -12,13 +12,6 @@ (struct-out t-subst) (struct-out i-subst) (struct-out i-subst/starred) (struct-out i-subst/dotted) substitution/c make-simple-substitution) -(define (subst v t e) (substitute t v e)) - -(d/c (make-simple-substitution vs ts) - (([vs (listof symbol?)] [ts (listof Type/c)]) () #:pre-cond (= (length vs) (length ts)) . ->d . [_ substitution/c]) - (for/hash ([v (in-list vs)] [t (in-list ts)]) - (values v (t-subst t)))) - (d-s/c subst-rhs () #:transparent) (d-s/c (t-subst subst-rhs) ([type Type/c]) #:transparent) (d-s/c (i-subst subst-rhs) ([types (listof Type/c)]) #:transparent) @@ -27,6 +20,16 @@ (define substitution/c (hash/c symbol? subst-rhs? #:immutable #t)) +(define (subst v t e) (substitute t v e)) + +(d/c (make-simple-substitution vs ts) + (([vs (listof symbol?)] [ts (listof Type/c)]) () + #:pre (vs ts) (= (length vs) (length ts)) + . ->i . [_ substitution/c]) + (for/hash ([v (in-list vs)] [t (in-list ts)]) + (values v (t-subst t)))) + + ;; substitute : Type Name Type -> Type (d/c (substitute image name target #:Un [Un (get-union-maker)]) ((Type/c symbol? Type?) (#:Un procedure?) . ->* . Type?)