You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compiler: _ENV upvalue is handed to every nested function (PUC only when free names are read) #412
Found during automated review of PR #400 (pre-existing divergence, also noted in that PR's description).
For local a, b = 1, 2; local function f() return a + b + a end, debug.getupvalue enumeration gives _ENV, a, b (nups == 3); PUC-Lua 5.3 gives a, b (nups == 2) because _ENV is only added to functions that actually reference a free (global) name.
Observable via debug.getupvalue/debug.upvalueid and upvalue counts; also a small perf cost (every closure carries an extra descriptor/cell hop).
Note: test/lua/compiler/upvalue_descriptor_test.exs pins the current (divergent) "_ENV,a,b" output — when fixing this, that expectation flips and is not a regression.
Activity