diff --git a/collects/typed-scheme/rep/type-rep.ss b/collects/typed-scheme/rep/type-rep.ss index 1ad80fd3..1365b5cd 100644 --- a/collects/typed-scheme/rep/type-rep.ss +++ b/collects/typed-scheme/rep/type-rep.ss @@ -298,7 +298,7 @@ (map list mname (map type-rec-id mty)))])]) ;; cls : Class -(dt Instance ([cls Class?]) [#:key 'instance]) +(dt Instance ([cls Type/c]) [#:key 'instance]) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/collects/typed-scheme/typecheck/tc-app.ss b/collects/typed-scheme/typecheck/tc-app.ss index 459ff0b6..341f2ae4 100644 --- a/collects/typed-scheme/typecheck/tc-app.ss +++ b/collects/typed-scheme/typecheck/tc-app.ss @@ -101,6 +101,7 @@ (let loop ([t (tc-expr cl)]) (match t [(tc-result1: (? Mu? t*)) (loop (ret (unfold t*)))] + [(tc-result1: (Union: '())) (ret (Un))] [(tc-result1: (and c (Class: pos-tys (list (and tnflds (list tnames _ _)) ...) _))) (unless (= (length pos-tys) (length (syntax->list pos-args))) @@ -109,7 +110,7 @@ ;; use for, since they might be different lengths in error case (for ([pa (in-syntax pos-args)] [pt (in-list pos-tys)]) - (tc-expr/check pa pt)) + (tc-expr/check pa (ret pt))) (for ([n names] #:when (not (memq n tnames))) (tc-error/delayed @@ -124,7 +125,7 @@ [else #f])]) (if s ;; this argument was present - (tc-expr/check s tfty) + (tc-expr/check s (ret tfty)) ;; this argument wasn't provided, and was optional #f))]) tnflds) diff --git a/collects/typed-scheme/typecheck/tc-expr-unit.ss b/collects/typed-scheme/typecheck/tc-expr-unit.ss index d1bd665c..e42ad506 100644 --- a/collects/typed-scheme/typecheck/tc-expr-unit.ss +++ b/collects/typed-scheme/typecheck/tc-expr-unit.ss @@ -362,7 +362,7 @@ [else (tc-error/expr "send: method ~a not understood by class ~a" s c)])] [ret-ty (tc/funapp rcvr args (ret ftype) (map tc-expr (syntax->list args)) expected)]) (if expected - (begin (check-below ret-ty expected) (ret expected)) + (begin (check-below ret-ty expected) expected) ret-ty))] [(tc-result1: t) (int-err "non-symbol methods not supported by Typed Scheme: ~a" t)])] [(tc-result1: t) (tc-error/expr #:return (or expected (ret (Un))) "send: expected a class instance, got ~a" t)])) diff --git a/collects/typed-scheme/typecheck/tc-let-unit.ss b/collects/typed-scheme/typecheck/tc-let-unit.ss index 2faed2c6..32d7e217 100644 --- a/collects/typed-scheme/typecheck/tc-let-unit.ss +++ b/collects/typed-scheme/typecheck/tc-let-unit.ss @@ -84,7 +84,7 @@ (loop (cdr names) (cdr exprs) (apply append (cdr names)) (cdr clauses)))] [else ;(for-each (lambda (vs) (for-each (lambda (v) (printf/log "Letrec Var: ~a~n" (syntax-e v))) vs)) names) - (do-check (lambda (stx e t) (tc-expr/check/t e t)) + (do-check (lambda (stx e t) (tc-expr/check e t)) names (map (lambda (l) (map get-type l)) names) form exprs body clauses expected)])))) ;; this is so match can provide us with a syntax property to