Contract fixes.

original commit: c739128703d917540ff963775459b6c75ccf2c80
This commit is contained in:
Sam Tobin-Hochstadt 2010-10-01 19:20:05 -07:00
parent 7876c75cbc
commit 5733f06d9a
2 changed files with 14 additions and 9 deletions

View File

@ -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?)])
(p/c [env+ (([e env?] [fs (listof Filter/c)] [bx (box/c boolean?)])
#:pre (bx) (unbox bx) . ->i . [_ env?])])

View File

@ -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?)