diff --git a/collects/typed-scheme/private/parse-type.ss b/collects/typed-scheme/private/parse-type.ss index 686bd2b1..a5f61ed0 100644 --- a/collects/typed-scheme/private/parse-type.ss +++ b/collects/typed-scheme/private/parse-type.ss @@ -73,7 +73,7 @@ (make-pred-ty (list (parse-type #'dom)) (parse-type #'rng) (parse-type #'pred-ty)))] [(dom ... rest ::: -> rng) (and (eq? (syntax-e #'->) '->) - (symbolic-identifier=? #'::: (quote-syntax *))) + (eq? (syntax-e #':::) '*)) (begin (add-type-name-reference #'->) (->* (map parse-type (syntax->list #'(dom ...))) (parse-type #'rest) (parse-type #'rng)))] @@ -106,17 +106,12 @@ (-values (map parse-type (syntax->list #'(tys ...))))] [(case-lambda tys ...) (eq? (syntax-e #'case-lambda) 'case-lambda) - (make-Function (map (lambda (ty) - (syntax-case* ty (->) symbolic-identifier=? - [(dom ... -> rng) - (make-arr - (map parse-type (syntax->list #'(dom ...))) - (parse-type #'rng))])) - (syntax->list #'(tys ...))))] - ;; I wish I could write this - #;[(case-lambda ([dom ... -> rng] ...)) (make-funty (list (make-arr (list (parse-type #'dom) ...) (parse-type #'rng)) ...))] - #;[(list-of t) (make-lst (parse-type #'t))] - #;[(Listof t) (make-lst (parse-type #'t))] + (make-Function + (for/list ([ty (syntax->list #'(tys ...))]) + (let ([t (parse-type ty)]) + (match t + [(Function: (list arr)) arr] + [_ (tc-error/stx ty "Component of case-lambda type was not a function clause")]))))] [(Vectorof t) (eq? (syntax-e #'Vectorof) 'Vectorof) (begin diff --git a/collects/typed-scheme/private/type-effect-convenience.ss b/collects/typed-scheme/private/type-effect-convenience.ss index b18e8bd1..8a1c95ef 100644 --- a/collects/typed-scheme/private/type-effect-convenience.ss +++ b/collects/typed-scheme/private/type-effect-convenience.ss @@ -249,8 +249,5 @@ (exit t)))] [_ (exit t)])))) -(define (tc-error/expr msg #:return [return (Un)] #:stx [stx (current-orig-stx)] . rest) - (tc-error/delayed #:stx stx (apply format msg rest)) - return) diff --git a/collects/typed-scheme/private/type-utils.ss b/collects/typed-scheme/private/type-utils.ss index 42bf4788..6d182581 100644 --- a/collects/typed-scheme/private/type-utils.ss +++ b/collects/typed-scheme/private/type-utils.ss @@ -23,7 +23,9 @@ unfold (struct-out Dotted) (struct-out DottedBoth) - just-Dotted?) + just-Dotted? + tc-error/expr + lookup-fail) ;; substitute : Type Name Type -> Type @@ -139,4 +141,11 @@ (define (just-Dotted? S) (and (Dotted? S) - (not (DottedBoth? S)))) \ No newline at end of file + (not (DottedBoth? S)))) + +(define (tc-error/expr msg #:return [return (make-Union null)] #:stx [stx (current-orig-stx)] . rest) + (tc-error/delayed #:stx stx (apply format msg rest)) + return) + +;; error for unbound variables +(define (lookup-fail e) (tc-error/expr "unbound identifier ~a" e))