diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-12-17 19:09:22 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-12-17 19:09:22 -0800 |
commit | 81715deb567a159997e3a774883f1910074ee0dc (patch) | |
tree | a2ea841dfd1be756b2e4f78734576fecfe5e7831 /tests/000 | |
parent | 8d21380003fb01ce01df4b062c50cc6cded0d02c (diff) | |
download | txr-81715deb567a159997e3a774883f1910074ee0dc.tar.gz txr-81715deb567a159997e3a774883f1910074ee0dc.tar.bz2 txr-81715deb567a159997e3a774883f1910074ee0dc.zip |
txr: bug in handling @{nil ...} variable match.
In March 2012, b7f1f4c5bbea86e288b6a4d68595c1d2d07217bd
introduced the feature that the @nil variable matches and
discards. This was incompletely implemented. Some cases
of a nil variable with modifiers fail to match.
* match.c (dest_bind): This function must correctly handle
the case when pattern is nil: it should just return bindings
without extending them. If the pattern is any nonbindable
symbol, it should indicate a failed match using t.
The logic has not been touched since 2009, at which time
an additional bogosity was introduced of calling
funcall(testfun, pattern, value) when pattern is a
non-bindable symbol. If value is a string, that could
never work. Possibly the idea is that the value could come
from a symbol-valued expression, such as one producing
a keyword symbol. We are not going to support that, unless
someone complains.
* tests/000/nilvar.txr, tests/000/nilvar.expected: New files,
providing a test case that fails without this commit.
Diffstat (limited to 'tests/000')
-rw-r--r-- | tests/000/nilvar.expected | 1 | ||||
-rw-r--r-- | tests/000/nilvar.txr | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/000/nilvar.expected b/tests/000/nilvar.expected new file mode 100644 index 00000000..70985094 --- /dev/null +++ b/tests/000/nilvar.expected @@ -0,0 +1 @@ +a:c diff --git a/tests/000/nilvar.txr b/tests/000/nilvar.txr new file mode 100644 index 00000000..a6d1391c --- /dev/null +++ b/tests/000/nilvar.txr @@ -0,0 +1,3 @@ +@(next :string "a !b c") +@(coll)@(cases)@{nil /!\S+/}@(or)@{var /\S+/}@(end)@(end) +@(do (put-line (join-with ":" var))) |