From d934a3e1fc57f3efcdd772ae2822efc845e74468 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 31 Mar 2018 13:28:22 -0700 Subject: expander: bugfix: fixed params visible to optionals. * eval.c (expand_params_rec): Add the parameter to the macro-time environment before processing rest of parameter list. This is already done for all the symbols of a macro-style destructuring; just not for a simple parameter. This is necessary, because the init forms of optional parameters occur in a lexical environment in which prior parameters are visible. The test case for this is that (lambda (x : (y x))) must not produce a warning about unbound x. --- eval.c | 1 + 1 file changed, 1 insertion(+) diff --git a/eval.c b/eval.c index 399c61c4..6880a457 100644 --- a/eval.c +++ b/eval.c @@ -994,6 +994,7 @@ static val expand_params_rec(val params, val menv, not_bindable_error(form, param); } else { param_ex = param; + new_menv = make_var_shadowing_env(menv, cons(param, nil)); } { -- cgit v1.2.3