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 f4334a48..7a2ae295 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 @@ -230,8 +230,9 @@ [(Values: (list (Result: t _ _))) t] [(ValuesDots: (list (Result: t _ _)) _ _) - t])]) - (subtype rng expected-ty))])))) + t] + [_ #f])]) + (and rng (subtype rng expected-ty)))])))) (define orig (map list doms rngs rests drests)) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/interactive-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/interactive-tests.rkt index ac749dba..e30068a3 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/interactive-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/interactive-tests.rkt @@ -168,4 +168,6 @@ (test-form-exn #rx"exactly two arguments" (:query-type/result)) (test-form-exn #rx"exactly two arguments" - (:query-type/result 1 2 3)))) + (:query-type/result 1 2 3)) + (test-form #rx"not in the given function's range" + (:query-type/result syntax-local-expand-expression Boolean)))) 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 f516bee1..dcb10d30 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 @@ -3123,6 +3123,15 @@ y) #:ret (ret -String -true-filter) #:msg #rx"expected: String.*given: (Null|'\\(\\))"] + + ;; PR 14493 + [tc-err + (let () + (define f values) + (: g (Any -> Boolean)) + (define (g x) (f x)) + (error "foo")) + #:msg #rx"Polymorphic function `f' could not be applied"] ) (test-suite