fixed error message for shadowing clause names; Closes PR 12621
This commit is contained in:
parent
fb7c7e3793
commit
ad50f144df
|
@ -101,11 +101,18 @@
|
|||
(syntax-case stx ()
|
||||
[(kw . E) (kwd-in? #'kw) (begin (->rec? #'kw #'E) (cons #'kw stx))]
|
||||
[(kw . E)
|
||||
(let ([kw (syntax-e #'kw)])
|
||||
(if (member kw (map syntax-e kwds))
|
||||
(raise-syntax-error tag (format "the ~a clause appears twice" kw) stx)
|
||||
(raise-syntax-error tag (format "~a clauses are not allowed when using ~a" kw tag)
|
||||
stx)))]
|
||||
(let* ([stx2 #'kw]
|
||||
[kw (syntax-e stx2)]
|
||||
[kw-appears-as-symbol
|
||||
(member kw (map syntax-e kwds))
|
||||
#;
|
||||
(for/or ((n kwds))
|
||||
(symbol=? kw (syntax-e n)))])
|
||||
(if kw-appears-as-symbol
|
||||
(raise-syntax-error
|
||||
tag (format "the ~a keyword seems to have been used as a variable" kw) stx2)
|
||||
(raise-syntax-error
|
||||
tag (format "~a clauses are not allowed within ~a" kw tag) stx)))]
|
||||
[_ (raise-syntax-error tag "expected a clause, but found something else" stx)]))
|
||||
stx:list))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang scheme/load
|
||||
#lang racket/load
|
||||
|
||||
;; purpose: when on-tick or on-xxx has been redefined,
|
||||
;; --- raise more specific error message
|
||||
|
@ -6,8 +6,8 @@
|
|||
|
||||
(error-print-source-location #f)
|
||||
|
||||
(define legal "big-bang: ~a clauses are not allowed when using big-bang")
|
||||
(define double "big-bang: the on-tick clause appears twice")
|
||||
(define legal "big-bang: ~a clauses are not allowed within big-bang")
|
||||
(define double "big-bang: the on-tick keyword seems to have been used as a variable")
|
||||
(define atleast "big-bang: expects a [to-draw handler] clause, missing")
|
||||
|
||||
;; is the mandatort to-draw clause specified
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
(universe 0
|
||||
(on-tick (lambda (w) (make-bundle (add1 w) '() '())) 1/28 3)
|
||||
(on-msg void)
|
||||
(on-msg (lambda (w sender msg) (make-bundle w '() '())))
|
||||
(on-new cons))
|
||||
|
|
Loading…
Reference in New Issue
Block a user