Skip to content

Commit 24e4d0b

Browse files
shhyourfindler
authored andcommitted
Fix redex-let error message.
The actual error message was accidentally passed as the format string to `redex-error`.
1 parent 8dfc1e2 commit 24e4d0b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@
114114
(define ((term-match/single/proc form-name lang ps0 cps rhss) term)
115115
(let loop ([ps ps0] [cps cps] [rhss rhss])
116116
(if (null? ps)
117-
(redex-error form-name
118-
(if (null? (cdr ps0))
119-
(format "term ~s does not match pattern ~s" term (car ps0))
120-
(format "no patterns matched ~s" term)))
117+
(if (null? (cdr ps0))
118+
(redex-error form-name "term ~s does not match pattern ~s" term (car ps0))
119+
(redex-error form-name "no patterns matched ~s" term))
121120
(let ([match (match-pattern (car cps) term)])
122121
(if match
123122
(begin

redex-test/redex/tests/tl-language.rkt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,11 @@
583583
(term (number_1 6) #:lang L))
584584
'(5 6)))
585585

586+
(test (with-handlers ([exn:fail:redex? exn-message])
587+
(redex-let empty-language ([~PATTERN 'TERM])
588+
"no error"))
589+
#rx"pattern ~PATTERN")
590+
586591
;; make sure the "before underscore" check works (no syntax error)
587592
(let ()
588593
(define-extended-language L2 empty-language [(τ υ) whatever])

0 commit comments

Comments
 (0)