From 541a47f7fd943f77f82983bd52a837db47b736a8 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Wed, 12 Nov 2008 15:59:24 +0000 Subject: [PATCH] Handle (Instance Foo) where Foo is unbound. Return correct error behavior. svn: r12410 --- collects/typed-scheme/private/parse-type.ss | 2 +- collects/typed-scheme/typecheck/tc-expr-unit.ss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/collects/typed-scheme/private/parse-type.ss b/collects/typed-scheme/private/parse-type.ss index 58560d2d50..be6d275263 100644 --- a/collects/typed-scheme/private/parse-type.ss +++ b/collects/typed-scheme/private/parse-type.ss @@ -47,7 +47,7 @@ [(Instance t) (eq? (syntax-e #'Instance) 'Instance) (let ([v (parse-type #'t)]) - (if (not (or (Mu? v) (Class? v) (Union? v))) + (if (not (or (Mu? v) (Class? v) (Union? v) (Error? v))) (begin (tc-error/delayed "Argument to Instance must be a class type, got ~a" v) (make-Instance (Un))) (make-Instance v)))] diff --git a/collects/typed-scheme/typecheck/tc-expr-unit.ss b/collects/typed-scheme/typecheck/tc-expr-unit.ss index ca2f20171f..9f0831ae0b 100644 --- a/collects/typed-scheme/typecheck/tc-expr-unit.ss +++ b/collects/typed-scheme/typecheck/tc-expr-unit.ss @@ -325,7 +325,7 @@ (begin (check-below ret-ty expected) (ret expected)) ret-ty))] [(tc-result: t) (int-err "non-symbol methods not supported by Typed Scheme: ~a" t)])] - [(tc-result: t) (tc-error/expr #:return (or expected (Un)) "send: expected a class instance, got ~a" t)])) + [(tc-result: t) (tc-error/expr #:return (or expected (ret (Un))) "send: expected a class instance, got ~a" t)])) ;; type-check a list of exprs, producing the type of the last one. ;; if the list is empty, the type is Void.