fix arity exception for a keyword procedure

Closes #3416
This commit is contained in:
Matthew Flatt 2020-09-30 07:14:24 -06:00
parent 5db75a92ae
commit 53ef242889
2 changed files with 11 additions and 1 deletions

View File

@ -773,6 +773,16 @@
(test (list the-a the-b) the-b) (test (list the-a the-b) the-b)
(test 0 procedure-arity the-b)) (test 0 procedure-arity the-b))
;; ----------------------------------------
;; Make sure wrong number with keywords is an arity exception:
(let ()
(define (hello a b #:key key) (display a))
(test #t
exn:fail:contract:arity?
(with-handlers ([values values])
(hello 1 #:key 'hi))))
;; ---------------------------------------- ;; ----------------------------------------
(report-errs) (report-errs)

View File

@ -1578,7 +1578,7 @@
(object-name p) (object-name p)
p))]) p))])
(raise (raise
(exn:fail:contract ((if (or extra-kw missing-kw) exn:fail:contract exn:fail:contract:arity)
(if extra-kw (if extra-kw
(if (keyword-procedure? p) (if (keyword-procedure? p)
(format (format