From 6438a2e747c834da59fbaf1704a72b184d40c5d8 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 8 Mar 2019 08:15:42 -0800 Subject: expander: tree-bind: fix incorrect param env. * eval.c (do_expand): A wrong thing is being done here: the macro is extended using the original parameter syntax, that has not been processed by expand_params. The body is then expanded using that environment. This subtly breaks support for parameter macros in tree-bind. They work, but there are spurious warnings about undefined variables during expansion, and the wrong scope handling can introduce bugs. The right thing is to derive new_menv by pulling the parameter symbols from params_ex. --- eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eval.c b/eval.c index dccf3fbd..a3b593ef 100644 --- a/eval.c +++ b/eval.c @@ -4673,10 +4673,10 @@ again: val params = pop(&args); val expr = pop(&args); val body = args; - val new_menv = make_var_shadowing_env(menv, get_param_syms(params)); - val ctx_expr_ex = expand(ctx_expr, menv); cons_bind (params_ex, body_ex0, expand_params(params, body, menv, t, form)); + val new_menv = make_var_shadowing_env(menv, get_param_syms(params_ex)); + val ctx_expr_ex = expand(ctx_expr, menv); val body_ex = expand_progn(body_ex0, new_menv); val expr_ex = expand(expr, new_menv); -- cgit v1.2.3