improve the error message in ->*
This commit is contained in:
parent
2f53b436f9
commit
3760de1fa9
|
@ -748,4 +748,9 @@
|
||||||
y)
|
y)
|
||||||
'pos
|
'pos
|
||||||
'neg))
|
'neg))
|
||||||
|
|
||||||
|
(contract-syntax-error-test
|
||||||
|
'->*-too-much-stuff
|
||||||
|
#'(->* () #:rest (listof procedure?) () any)
|
||||||
|
#rx"expected the #:rest keyword to be followed only by the range")
|
||||||
)
|
)
|
||||||
|
|
|
@ -775,6 +775,13 @@
|
||||||
(values #'() leftover)])]
|
(values #'() leftover)])]
|
||||||
[(rst leftover)
|
[(rst leftover)
|
||||||
(syntax-case 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)
|
[(#:rest rest-expr . leftover)
|
||||||
(values #'rest-expr #'leftover)]
|
(values #'rest-expr #'leftover)]
|
||||||
[_ (values #f leftover)])]
|
[_ (values #f leftover)])]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user