From 5431ddb6c1559f9dc6428b07d1bf340f0fd82759 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Mon, 9 Jun 2014 13:56:28 -0400 Subject: [PATCH] Adjust TR error message for consistency The non-productive type check in type parsing and in type alias setup should produce the same failure messages. --- .../typed-racket/env/type-alias-helper.rkt | 7 ++++--- .../tests/typed-racket/unit-tests/typecheck-tests.rkt | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt index dacc520f33..8fe6711724 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt @@ -71,9 +71,10 @@ [((PolyRow: _ _ body)) (check body)] [(_) #t]) (unless (check type) - (tc-error/stx - id - "Recursive types are not allowed directly inside their definition"))) + (tc-error/fields + "parse error in type" + #:stx id + #:more "recursive types are not allowed directly inside their definition"))) ;; get-type-alias-info : Listof -> Listof Dict ;; diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt index c0c7e2360c..62b052dccf 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -2615,9 +2615,9 @@ [tc-err (let () (define-type-alias A (Class #:implements A)) "dummy") #:msg "Recursive #:implements clause not allowed"] [tc-err (let () (define-type-alias X (U X #f)) "dummy") - #:msg "Recursive types are not allowed directly inside"] + #:msg "recursive types are not allowed directly inside"] [tc-err (let () (define-type-alias X (All (A #:row) X)) "dummy") - #:msg "Recursive types are not allowed directly inside"] + #:msg "recursive types are not allowed directly inside"] ;; Check the more precise Tarjan's algorithm-based letrec-values type checking [tc-e ;; An example from Eric Dobson (see gh372) that shows that precisely