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
commit2213da70777fe419e71b00e70503291b01fe534f (patch)
tree6cd9dcba263ab1b2e00bdedebffa18860cc23f2a
parente501fdc922d24207d4773c8a0bd8245bea3d636f (diff)
downloadtxr-2213da70777fe419e71b00e70503291b01fe534f.tar.gz
txr-2213da70777fe419e71b00e70503291b01fe534f.tar.bz2
txr-2213da70777fe419e71b00e70503291b01fe534f.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)