From 2c4403e48020fbf50f2fc3ad5e50ae5ecf69859f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 1 Apr 2018 12:00:26 -0700 Subject: 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. --- share/txr/stdlib/compiler.tl | 8 +++++--- 1 file 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) -- cgit v1.2.3