Fix instantiate and abstract to handle bounds properly.

NEW INVARIANT - only use instantiate w/ names

original commit: 017f756c7735a0e6083fa2f52eaafc0f20b11912
This commit is contained in:
Sam Tobin-Hochstadt 2008-06-10 11:29:56 -04:00
parent 69c7303342
commit 583b640833
2 changed files with 9 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#lang scheme/base
(require "type-rep.ss" "type-name-env.ss" "tc-utils.ss"
"type-utils.ss"
"type-utils.ss"
mzlib/plt-match
mzlib/trace)

View File

@ -17,7 +17,8 @@
tc-result:
tc-result-equal?
effects-equal?
tc-result-t)
tc-result-t
unfold)
;; substitute : Type Name Type -> Type
@ -35,7 +36,12 @@
(foldr (lambda (e acc) (substitute (cadr e) (car e) acc)) t s))
;; unfold : Type -> Type
;; must be applied to a Mu
(define (unfold t)
(match t
[(Mu: name b) (substitute t name b)]
[_ (int-err "unfold: requires Mu type, got ~a" t)]))
(define (instantiate-poly t types)
(match t