diff options
Diffstat (limited to 'testes/locals.lua')
-rw-r--r-- | testes/locals.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/testes/locals.lua b/testes/locals.lua index ddb75054..d50beaa5 100644 --- a/testes/locals.lua +++ b/testes/locals.lua @@ -360,6 +360,26 @@ do end +do + -- bug in 5.4.4: 'break' may generate wrong 'close' instruction when + -- leaving a loop block. + + local closed = false + + local o1 = setmetatable({}, {__close=function() closed = true end}) + + local function test() + for k, v in next, {}, nil, o1 do + local function f() return k end -- create an upvalue + break + end + assert(closed) + end + + test() +end + + do print("testing errors in __close") -- original error is in __close |