From ed88f9e3ef274ae2c46b6d3c8e55b67fe76a5965 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 3 May 2021 07:23:43 -0700 Subject: compiler: bug: not warning bad uses of some local funs. When a lexical function defined with flet or labels is called with the wrong arguments, this is not being diagnosed if that function is being lifted to load-time. This is because the sys:load-time-lit that the lambda is wrapped with is not propagating the pars attribute of the frag structure from the lambda to its own returned frag. * share/txr/stdlib/compiler.tl (compiler comp-load-time-lit): After compiling the expression to obtain the exp frag, stuff exp.pars to both the lt-frag that is generated, as well as to the returned dummy frag carrying the dreg access that retrieves the function. It's important for this returned frag to carry the info, because from there it is propagated to the function binding by comp-fbind by the (set bind.pars frag.pars) expression. --- share/txr/stdlib/compiler.tl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index a395347d..2dba0bbe 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -1638,10 +1638,11 @@ ^(,*exp.code ,*me.(maybe-mov dreg exp.oreg)) exp.fvars - exp.ffuns)))) + exp.ffuns + exp.pars)))) (misleading-ref-check exp env form) (push lt-frag me.lt-frags) - (new (frag dreg nil)))))))) + (new (frag dreg nil nil nil exp.pars)))))))) (defmeth compiler optimize (me insns) (let ((olev *opt-level*)) -- cgit v1.2.3