More precise syntax errors for let
and friends
This commit is contained in:
parent
6a69da76e2
commit
f3fa5d1669
|
@ -29,12 +29,18 @@
|
|||
#t
|
||||
(let-values ([(tail1) (stx-cdr stx)])
|
||||
(if (stx-null? tail1)
|
||||
#t
|
||||
(if named?
|
||||
(raise-syntax-error #f "bad syntax (missing name or binding pairs)")
|
||||
(raise-syntax-error #f "bad syntax (missing binding pairs)" stx))
|
||||
(if (stx-null? (stx-cdr tail1))
|
||||
#t
|
||||
(if named?
|
||||
(raise-syntax-error #f "bad syntax (missing binding pairs or body)" stx)
|
||||
(raise-syntax-error #f "bad syntax (missing body)" stx))
|
||||
(if named?
|
||||
(if (symbol? (syntax-e (stx-car tail1)))
|
||||
(stx-null? (stx-cdr (stx-cdr tail1)))
|
||||
(if (stx-null? (stx-cdr (stx-cdr tail1)))
|
||||
(raise-syntax-error #f "bad syntax (missing body)" stx)
|
||||
#f)
|
||||
#f)
|
||||
#f)))))
|
||||
(raise-syntax-error #f "bad syntax" stx)
|
||||
|
|
|
@ -1740,6 +1740,18 @@
|
|||
|
||||
(test #t dynamic-require ''use-rename-checker 'v)
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Check `let` error messages
|
||||
|
||||
(syntax-test #'(let*) #rx"missing binding")
|
||||
(syntax-test #'(let* ([x 10])) #rx"missing body")
|
||||
(syntax-test #'(let) #rx"missing name or")
|
||||
(syntax-test #'(let x) #rx"missing binding pairs or")
|
||||
(syntax-test #'(let ([10 10])) #rx"missing binding pairs or")
|
||||
(syntax-test #'(let x ([10 10])) #rx"missing body")
|
||||
(syntax-test #'(letrec) #rx"missing binding")
|
||||
(syntax-test #'(letrec ([x 3])) #rx"missing body")
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
Loading…
Reference in New Issue
Block a user