From 7f44bfec8bb0c4728f14b60c621f410e2af78dd4 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Thu, 26 Jun 2014 01:35:32 -0400 Subject: [PATCH] Fix error for application Procedure type values Removal of top-arr in the internal representation changed the error message and we didn't have a test for it. Closes PR 14601 original commit: 9a14c9c4206671d9627b5a7bbc48b76e9f95526e --- .../typed-racket/typecheck/tc-app-helper.rkt | 3 ++- .../tests/typed-racket/unit-tests/typecheck-tests.rkt | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app-helper.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app-helper.rkt index 81c5d150..c8ecbb75 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app-helper.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-app-helper.rkt @@ -105,7 +105,8 @@ (if tail-bound (cons tail-ty tail-bound) #f))) (cond [(null? doms) - (int-err "How could doms be null: ~a" ty)] + (tc-error/expr "cannot apply function of type Procedure" + #:return return)] [(and (= 1 (length doms)) (not (car rests)) (not (car drests)) (not tail-ty) (not tail-bound)) (tc-error/expr #:return return 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 72538fb2..d7eb57de 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 @@ -3106,6 +3106,13 @@ ((if (even? 4) add1 (inst values Integer)) 4) -Int] + ;; PR 14601 + [tc-err + (let () + (: f Procedure) + (define f (lambda () 'hi)) + (f)) + #:msg "cannot apply function of type Procedure"] ) (test-suite