From cd4de7519376b8ea1b3c817d5ef0e2fa687d0361 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 14 Jan 2014 16:55:21 -0600 Subject: [PATCH] make sure redex-match? does the duplicate non-terminals check closes PR 14290 --- pkgs/redex-pkgs/redex-lib/redex/private/matcher.rkt | 3 +-- pkgs/redex-pkgs/redex-test/redex/tests/tl-test.rkt | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/redex-pkgs/redex-lib/redex/private/matcher.rkt b/pkgs/redex-pkgs/redex-lib/redex/private/matcher.rkt index adcb675bec..b3255def25 100644 --- a/pkgs/redex-pkgs/redex-lib/redex/private/matcher.rkt +++ b/pkgs/redex-pkgs/redex-lib/redex/private/matcher.rkt @@ -621,8 +621,7 @@ See match-a-pattern.rkt for more details ;; match-pattern? : compiled-pattern exp -> boolean (define (match-pattern? compiled-pattern exp) - (let ([results ((compiled-pattern-cp compiled-pattern) exp #f)]) - (and results #t))) + (and (match-pattern compiled-pattern exp) #t)) ;; match-pattern : compiled-pattern exp -> (union #f (listof bindings)) (define (match-pattern compiled-pattern exp) diff --git a/pkgs/redex-pkgs/redex-test/redex/tests/tl-test.rkt b/pkgs/redex-pkgs/redex-test/redex/tests/tl-test.rkt index 5c4bbff208..252e09af4b 100644 --- a/pkgs/redex-pkgs/redex-test/redex/tests/tl-test.rkt +++ b/pkgs/redex-pkgs/redex-test/redex/tests/tl-test.rkt @@ -280,6 +280,9 @@ (test (map match-bindings (redex-match grammar (a ..._1) (term (a a a)))) '(())) + ;; make sure redex-match? does the equality check + (test (redex-match? empty-language (any_0 any_0) (term (1 2))) #f) + (define-syntax (test-match stx) (syntax-case stx () [(_ actual (((var val) ...) ...))