diff --git a/collects/plai/datatype.rkt b/collects/plai/datatype.rkt index 960cbedce4..0f8f397204 100644 --- a/collects/plai/datatype.rkt +++ b/collects/plai/datatype.rkt @@ -352,7 +352,12 @@ ;;; far, either the clauses are malformed or the error is completely ;;; unintelligible. [(_ type-id test-expr clauses ...) - (map validate-clause (syntax->list #'(clauses ...)))] + (begin + (unless (identifier? #'type-id) + (plai-syntax-error 'type-case #'type-id type-case:not-a-type)) + (validate-and-remove-type-symbol #'type-id (syntax-local-value #'type-id (λ () #f))) + (andmap validate-clause (syntax->list #'(clauses ...))) + (plai-syntax-error 'type-case stx "Unknown error"))] [_ (plai-syntax-error 'type-case stx type-case:generic)]))