summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stdlib/match.tl2
-rw-r--r--tests/011/patmatch.tl14
2 files changed, 15 insertions, 1 deletions
diff --git a/stdlib/match.tl b/stdlib/match.tl
index 17870be2..55d50417 100644
--- a/stdlib/match.tl
+++ b/stdlib/match.tl
@@ -782,7 +782,7 @@
(when (> pc.nfixed min-args)
(set exp ^(when ,[present-vec (pred pc.nfixed)]
,exp)))
- (when (< pc.nfixed max-args)
+ (when (and (not vp) (< pc.nfixed max-args))
(set exp ^(unless ,[present-vec pc.nfixed]
,exp)))
(when (and variadic (not vp) (= pc.nfixed max-args))
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index 08bcd0f7..81cda935 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -247,6 +247,20 @@
((@x @y) :no-match)) 1 2 3]
:error)))
+(test
+ [(lambda-match
+ ((@a @b) (list a b))
+ ((@x . @y) (list x y)))
+ 1 2 3]
+ (1 (2 3)))
+
+(test
+ [(lambda-match
+ ((@a @b) (list a b))
+ (@x x))
+ 1 2 3]
+ (1 2 3))
+
(defun-match fib
((0) 1)
((1) 1)