summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-01 12:00:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-01 12:00:26 -0700
commit2c4403e48020fbf50f2fc3ad5e50ae5ecf69859f (patch)
tree6cd9dcba263ab1b2e00bdedebffa18860cc23f2a
parent4567fe9b8c9937414ee7f3367279f2e204159438 (diff)
downloadtxr-2c4403e48020fbf50f2fc3ad5e50ae5ecf69859f.tar.gz
txr-2c4403e48020fbf50f2fc3ad5e50ae5ecf69859f.tar.bz2
txr-2c4403e48020fbf50f2fc3ad5e50ae5ecf69859f.zip
compiler: bugfix: bad len check for tree-case.
* share/txr/stdlib/compiler.tl (expand-bind-mac-params): When the strict parameter is the keyword symbol : we are mis-translating the length check. We are ignoring the presence of the rest-par, and checking for an exact length. When rest-par is present, we must check only for a minimum number of fixed parameters.
-rw-r--r--share/txr/stdlib/compiler.tl8
1 files changed, 5 insertions, 3 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 7a289290..57b56828 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1131,9 +1131,11 @@
,(berr nil))))))
((null strict) nil)
((symbolp strict)
- ^((if (or (< ,plen ,nreq)
- (> ,plen ,nfix))
- (return-from ,err-block ',strict)))))
+ ^((if (< ,plen ,nreq)
+ (return-from ,err-block ',strict))
+ ,*(unless rest-par
+ ^((if (> ,plen ,nfix)
+ (return-from ,err-block ',strict)))))))
,*(append-each ((k key-pars))
(tree-bind (key . sym) k
(push sym vars)