(module tc-let-unit (lib "a-unit.ss")
(require "signatures.ss"
(lib "match.ss")
"types.ss"
"types-aux.ss"
"effects.ss"
"tc-utils.ss"
"subtype.ss"
"subst.ss"
"infer2.ss"
"type-annotation.ss"
"type-env.ss"
"type-environments.ss"
"lexical-env.ss"
(lib "kerncase.ss" "syntax"))
(require-for-template (lib "match.ss") "internal-forms.ss" mzscheme)
(require-for-syntax (lib "match.ss") "internal-forms.ss")
(import typechecker^)
(export tc-let^)
(define (do-check expr->type namess types form exprs body)
(define clauses (syntax-case form () [(lv cl . b) (syntax->list #'cl)]))
(with-lexical-env/extend
namess
types
(for-each (lambda (stx e t) (check-type stx (expr->type e) t))
clauses
exprs
(map list->values-ty types))
(tc-exprs (syntax->list body))))
(define (tc/letrec-values namess exprs body form)
(let* ([names (map syntax->list (syntax->list namess))]
[exprs (syntax->list exprs)]
[types (map (lambda (l) (map get-type l)) names)])
(do-check tc-expr/t names types form exprs body)))
(define (tc/let-values namess exprs body form)
(let* ( [names (map syntax->list (syntax->list namess))]
[exprs (syntax->list exprs)]
[inferred-types (map tc-expr/t exprs)]
[types (map get-type/infer names inferred-types)])
(do-check (lambda (x) x) names types form inferred-types body)))
)