diff --git a/collects/tests/typed-scheme/unit-tests/typecheck-tests.rkt b/collects/tests/typed-scheme/unit-tests/typecheck-tests.rkt index d522b497..47bb0db8 100644 --- a/collects/tests/typed-scheme/unit-tests/typecheck-tests.rkt +++ b/collects/tests/typed-scheme/unit-tests/typecheck-tests.rkt @@ -812,6 +812,7 @@ ([j : Natural (+ i 'a) (+ j i)]) ((>= j 10)) #f)] + [tc-err (apply +)] [tc-e/t (let ([x eof]) (if (procedure? x) diff --git a/collects/typed-scheme/typecheck/tc-app.rkt b/collects/typed-scheme/typecheck/tc-app.rkt index ff4e3f68..45012175 100644 --- a/collects/typed-scheme/typecheck/tc-app.rkt +++ b/collects/typed-scheme/typecheck/tc-app.rkt @@ -257,7 +257,11 @@ ;; produces the first n-1 elements of the list, and the last element (define (split l) (let-values ([(f r) (split-at l (sub1 (length l)))]) (values f (car r)))) - (define-values (fixed-args tail) (split (syntax->list args))) + (define-values (fixed-args tail) + (let ([args* (syntax->list args)]) + (if (null? args*) + (tc-error "apply requires a final list argument, given only a function argument of type ~a" (match f-ty [(tc-result1: t) t])) + (split args*)))) (match f-ty [(tc-result1: (Function: (list (arr: doms rngs rests drests (list (Keyword: _ _ #f) ...)) ...)))