From 8b752ddf14c1987411906d07a8c68f72f168b9b7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Sat, 17 Aug 2024 12:37:04 -0300 Subject: Bug: wrong code gen. for indices with comparisons In function 'luaK_exp2val', used to generate code for indices: Macro 'hasjumps' does not consider the case when the whole expression is a "jump" (a test). In all other of its uses, the surrounding code ensures that the expression cannot be VJMP. --- testes/closure.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'testes') diff --git a/testes/closure.lua b/testes/closure.lua index de1b54ec..07149ef3 100644 --- a/testes/closure.lua +++ b/testes/closure.lua @@ -3,6 +3,14 @@ print "testing closures" +do -- bug in 5.4.7 + _ENV[true] = 10 + local function aux () return _ENV[1 < 2] end + assert(aux() == 10) + _ENV[true] = nil +end + + local A,B = 0,{g=10} local function f(x) local a = {} -- cgit v1.2.3-55-g6feb