From 88be89a6449f883b5e5c3b9187cfd63725edd91c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 2 Feb 2021 06:26:14 -0800 Subject: matcher: new failing backreferencing test case. * tests/011/patmatch.tl: New test cases that break. The (copy var-list) logic in the handling of and and or is incomplete. The bifurcated vars must be merged together into the original vars. Without this, it looks as if the operator didn't bind any variables, and they can be repeated again without backreferencing. In the broken examples, variable a is taking on the value 2 instead of mismatching the previous value of 1. --- tests/011/patmatch.tl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl index 0068eabb..46fc2719 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -90,6 +90,10 @@ (test (when-match @(or @(require @a (oddp a)) @b @c) 2 (list a b c)) (nil 2 nil)) +(test (if-match (@(or @a) @a) '(1 2) a :no) :no) +(test (if-match (@(and @a) @a) '(1 2) a :no) :no) + + (test (collect-each ((obj (list '(1 2 3) '(4 5) -- cgit v1.2.3