summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--infer2.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/infer2.scm b/infer2.scm
index 18f8ef2..b7211c7 100644
--- a/infer2.scm
+++ b/infer2.scm
@@ -143,13 +143,12 @@
vals*))
(define env* (append (map cons vars val-types) env))
(define body* (annotate-exp body env*))
- (pk 'body* body*)
- (make-texp (texp-types body*)
+ (make-texp (map (lambda (_type) (fresh-type-variable)) (texp-types body*))
`(let ,(map list vars vals*) ,body*)))
(define-matcher (annotate:begin ('begin exps ... last) env)
(define last* (annotate-exp last env))
- (make-texp (texp-types last*)
+ (make-texp (map (lambda (_type) (fresh-type-variable)) (texp-types last*))
`(begin ,@(map (lambda (exp) (annotate-exp exp env)) exps)
,last*)))
@@ -222,12 +221,15 @@
(define-matcher (constrain:let ((? type? types) ...)
('let (((? symbol? vars) (? texp? vals)) ...)
(? texp? body)))
- (append (program-constraints body)
- (append-map program-constraints vals)))
+ (cons (constrain types (texp-types body))
+ (append (program-constraints body)
+ (append-map program-constraints vals))))
(define-matcher (constrain:begin ((? type? types) ...)
- ('begin (? texp? texps) ...))
- (append-map program-constraints texps))
+ ('begin (? texp? texps) ... (? texp? last)))
+ (cons (constrain types (texp-types last))
+ (append (program-constraints last)
+ (append-map program-constraints texps))))
(define-matcher (constrain:lambda ((? procedure-type? type))
('lambda ((? symbol? args) ...)