From fbfd09e8045133ca0b81febe1d9114070a86f425 Mon Sep 17 00:00:00 2001 From: Burke Fetscher Date: Wed, 4 Sep 2013 19:40:07 -0500 Subject: [PATCH] Fix variable prefix/except bug. --- pkgs/redex-pkgs/redex-lib/redex/private/pat-unify.rkt | 6 +++--- pkgs/redex-pkgs/redex-test/redex/tests/unify-tests.rkt | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/redex-pkgs/redex-lib/redex/private/pat-unify.rkt b/pkgs/redex-pkgs/redex-lib/redex/private/pat-unify.rkt index 732bee917d..1f65e7d40a 100644 --- a/pkgs/redex-pkgs/redex-lib/redex/private/pat-unify.rkt +++ b/pkgs/redex-pkgs/redex-lib/redex/private/pat-unify.rkt @@ -452,9 +452,9 @@ ║ v2 ║ ║ ║ ║ ║ ╠════════════════════════╬══════════════════════════╬════════════════════════════════╬═══════════════════════════════╬════════════════╣ ║ ║ (cond ║ (and/fail ║(u*-2pvars ║ ║ - ║ `(variable-prefix ,p2) ║ [(sym-pref? p1 p2) ║ (andmap ║ v2 ║ ║ - ║ ║ `(variable-prefix ,p2)]║ (curry sym-pref? p2) ║ `(variable-except ║ ║ - ║ ║ [(sym-pref? p2 p1) ║ e1) ║ ,@(compiled-lang-literals L)) ║ ║ + ║ `(variable-prefix ,p2) ║ [(sym-pref? p1 p2) ║ (not (ormap ║ v2 ║ ║ + ║ ║ `(variable-prefix ,p2)]║ (curry sym-pref? p2) ║ `(variable-except ║ ║ + ║ ║ [(sym-pref? p2 p1) ║ e1)) ║ ,@(compiled-lang-literals L)) ║ ║ ║ ║ `(variable-prefix ,p1)]║ v2) ║ L) ║ ║ ║ ║ [else (unif-fail)]) ║ ║ ║ ║ ╠════════════════════════╬══════════════════════════╬════════════════════════════════╣ ║ ║ diff --git a/pkgs/redex-pkgs/redex-test/redex/tests/unify-tests.rkt b/pkgs/redex-pkgs/redex-test/redex/tests/unify-tests.rkt index 0026de67aa..e58beee5a9 100644 --- a/pkgs/redex-pkgs/redex-test/redex/tests/unify-tests.rkt +++ b/pkgs/redex-pkgs/redex-test/redex/tests/unify-tests.rkt @@ -515,7 +515,8 @@ ['variable '(variable-except a)] ['variable-not-otherwise-mentioned '(variable-except a)] ['(variable-except b) '(variable-except a b)] - ['(variable-prefix a) '(variable-prefix a)])) + ['(variable-prefix a) #f] + ['(variable-prefix b) '(variable-prefix b)])) (unify-all/results/no-bindings '(variable-prefix a) (hash) @@ -535,6 +536,8 @@ ['(nt e) '(cstr (e) (variable-prefix a))] ['variable '(variable-prefix a)] ['variable-not-otherwise-mentioned '(variable-prefix a)] + ['(variable-except b bb c) '(variable-prefix a)] + ['(variable-except b ab c) #f] ['(variable-prefix a) '(variable-prefix a)] ['(variable-prefix b) #f]))