Fix error message for 1-arg apply

original commit: 1e15ce1f3299d235cd72eeb171f7224099fba41a
This commit is contained in:
Sam Tobin-Hochstadt 2010-06-17 15:57:13 -04:00
parent cfce17b8d1
commit a4cec9ce13
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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) ...)) ...)))