improve the error message in ->*

This commit is contained in:
Robby Findler 2016-11-01 17:50:31 -05:00
parent 2f53b436f9
commit 3760de1fa9
2 changed files with 12 additions and 0 deletions

View File

@ -748,4 +748,9 @@
y)
'pos
'neg))
(contract-syntax-error-test
'->*-too-much-stuff
#'(->* () #:rest (listof procedure?) () any)
#rx"expected the #:rest keyword to be followed only by the range")
)

View File

@ -775,6 +775,13 @@
(values #'() leftover)])]
[(rst leftover)
(syntax-case leftover ()
[(#:rest rest-expr one-thing another-thing)
(and (not (keyword? #'one-thing))
(not (keyword? #'another-thing)))
(raise-syntax-error
#f
"expected the #:rest keyword to be followed only by the range (possibly with pre- and post-conditions)"
stx #'another-thing)]
[(#:rest rest-expr . leftover)
(values #'rest-expr #'leftover)]
[_ (values #f leftover)])]