redex-match violates its documented contract

This patch fixes the problem that the hole matcher may return an empty
list rather than a #f that gets sent to the caller of redex-match. I
re-ran the Redex tests and found no violations. However, I am not
confident that there isn't a more correct place to put this '() -> #f
replacement.

I will be immediately forwarding this push email to Robby to have him
check it.
This commit is contained in:
Jay McCarthy 2012-03-22 22:17:27 -06:00
parent 523ccff762
commit 99f1cc44df
2 changed files with 8 additions and 1 deletions

View File

@ -1324,7 +1324,10 @@ See match-a-pattern.rkt for more details
(let loop ([mtches mtches]
[acc null])
(cond
[(null? mtches) acc]
[(null? mtches)
(if (null? acc)
#f
acc)]
[else
(let* ([mtch (car mtches)]
[bindings (mtch-bindings mtch)]

View File

@ -424,6 +424,10 @@
(test (and (redex-match L -b 100) #t) #t)
(test (redex-match L -b 3) #f))
(let ()
(test (redex-match empty-language number 'a) #f)
(test (redex-match empty-language (in-hole hole number) 'a) #f))
(parameterize ([current-namespace (make-base-namespace)])
(eval '(require redex/reduction-semantics redex/pict))
(eval '(define-language L