diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-11 07:48:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-11 07:48:12 -0700 |
commit | 54c276a0322a369079ba480aca98b4c0ddf70365 (patch) | |
tree | cc3d601a1da01eb92f1eac5fa7bac35b0710836c /stdlib | |
parent | b1c7380ce9302c18edbce98e99ddb30fabd99abb (diff) | |
download | txr-54c276a0322a369079ba480aca98b4c0ddf70365.tar.gz txr-54c276a0322a369079ba480aca98b4c0ddf70365.tar.bz2 txr-54c276a0322a369079ba480aca98b4c0ddf70365.zip |
lambda-match: bug: over-strict match in variadic pattern.
* stdlib/match.tl (expand-lambda-match): A pattern that
is shorter than the maximum number of arguments is
augmented with a check ensuring that no fixed arguments
are present beyond those that the pattern requires.
However, this check must be omitted if the pattern is
variadic, because those excess arguments match its tail
pattern.
* tests/011/patmatch.tl: Cases added.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/match.tl | 2 |
1 files changed, 1 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)) |