summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/txr/stdlib/match.tl2
-rw-r--r--tests/011/patmatch.tl1
2 files changed, 2 insertions, 1 deletions
diff --git a/share/txr/stdlib/match.tl b/share/txr/stdlib/match.tl
index 920ca14e..8c7a4fcf 100644
--- a/share/txr/stdlib/match.tl
+++ b/share/txr/stdlib/match.tl
@@ -540,7 +540,7 @@
(defun non-triv-pat-p (syntax)
(match-case syntax
((@(op eq 'sys:expr) (@(bindable) . @nil)) t)
- ((@(op eq 'sys:var) @(bindable) . @nil) t)
+ ((@(op eq 'sys:var) @(or @(bindable) nil) . @nil) t)
((@pat . @rest) (or (non-triv-pat-p pat)
(non-triv-pat-p rest)))
(#R(@from @to) (or (non-triv-pat-p from)
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index 6a9c6f18..7768e89b 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -9,6 +9,7 @@
(yes no))
(test (when-match @a 42 (list a)) (42))
+(test (when-match (@nil) '(1) 'yes) yes)
(test (when-match (@a @b @c) '(1 2 3) (list c b a)) (3 2 1))
(test (if-match (@a @b @c . @d) '(1 2 3 . 4) (list d c b a)) (4 3 2 1))