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.
🤖 Filed from an automated review pass.
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.getupvalueenumeration gives_ENV, a, b(nups == 3); PUC-Lua 5.3 givesa, b(nups == 2) because_ENVis only added to functions that actually reference a free (global) name.Observable via
debug.getupvalue/debug.upvalueidand upvalue counts; also a small perf cost (every closure carries an extra descriptor/cell hop).Note:
test/lua/compiler/upvalue_descriptor_test.exspins the current (divergent)"_ENV,a,b"output — when fixing this, that expectation flips and is not a regression.🤖 Filed from an automated review pass.