From 7b26a8a95f544c04c20af9fdeac16624685a15b6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 30 Jan 2021 23:11:47 -0800 Subject: @(rebind): bugfix: don't clobber right side variable. * Makefile (tst/tests/000/binding.ok): Pass -B to txr for this new test. * match.c (v_rebind): Fix gaping copy-and-paste bug here, which causes rebind to take on the behavior of local/forget; it takes all symbols that appear as its arguments from the environment and produces an environment in which they don't exist. What we want is to remove the left variables from the environment, and since that is a nested pattern, the right way to do that is to flatten it. Bug reported by Frank Schwidom. * tests/000/binding.txr: New file. * tests/000/binding.expected: New file. * txr.1: Improve documentation of @(rebind), also making improvements in @(set) documentation. --- tests/000/binding.expected | 6 ++++++ tests/000/binding.txr | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 tests/000/binding.expected create mode 100644 tests/000/binding.txr (limited to 'tests') diff --git a/tests/000/binding.expected b/tests/000/binding.expected new file mode 100644 index 00000000..9e5303f0 --- /dev/null +++ b/tests/000/binding.expected @@ -0,0 +1,6 @@ +x="1" +y="2" +z[0]="1" +z[1]="2" +a="1" +b="0" diff --git a/tests/000/binding.txr b/tests/000/binding.txr new file mode 100644 index 00000000..95faa20d --- /dev/null +++ b/tests/000/binding.txr @@ -0,0 +1,5 @@ +@(bind x 1) +@(bind y 2) +@(rebind z (x y)) +@(bind (a b) (0 1)) +@(rebind (a b) (b a)) -- cgit v1.2.3