Skip to content

Commit b6b11cc

Browse files
committed
add some missing syntax error checks
1 parent 52bccd9 commit b6b11cc

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

redex-lib/redex/private/judgment-form.rkt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,10 @@
11321132
(define mode (syntax->datum #'_mode))
11331133
(cond
11341134
[(number? mode)
1135-
#'(λ (_)
1136-
(error 'syn-err-name
1137-
"judgment forms no mode cannot be used in term"))]
1135+
(raise-syntax-error
1136+
(syntax-e #'syn-err-name)
1137+
"modeless judgment forms cannot be used in term"
1138+
#'jdg-name)]
11381139
[(and mode (member 'O mode))
11391140
#'(λ (_)
11401141
(error 'syn-err-name

redex-lib/redex/private/reduction-semantics.rkt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
(rename-in racket/match (match match:)))
2525

2626
(require (for-syntax syntax/name
27+
syntax/stx
2728
"keyword-macros.rkt"
2829
"cycle-check.rkt"
2930
"loc-wrapper-ct.rkt"
@@ -1735,11 +1736,6 @@
17351736
[_
17361737
(set)]))
17371738

1738-
(define-for-syntax (check-arity-consistency mode contracts full-def)
1739-
(when (and contracts (not (= (length mode) (length contracts))))
1740-
(raise-syntax-error
1741-
#f "mode and contract specify different numbers of positions" full-def)))
1742-
17431739
(define-for-syntax (defined-name declared-names clauses orig-stx)
17441740
(with-syntax ([(((used-names _ ...) _ ...) ...) clauses])
17451741
(define-values (the-name other-names)
@@ -3085,6 +3081,13 @@
30853081
#'jf))
30863082
(define a-judgment-form (syntax-local-value #'jf))
30873083
(define mode (judgment-form-mode a-judgment-form))
3084+
(when (number? mode)
3085+
(raise-syntax-error 'test-judgment-holds
3086+
(string-append
3087+
"modeless judgment forms should supply only the their name"
3088+
" as the first argument")
3089+
stx
3090+
(stx-car (stx-cdr stx))))
30883091
(define orig-jf-stx (list-ref (syntax->list stx) 1))
30893092
(define jf-list (syntax->list #'(jf . rest)))
30903093
(cond

0 commit comments

Comments
 (0)