Global initialization checks name conflict

Initialization "global a = 10" raises an error if global 'a' is already
defined, that is, it has a non-nil value.
This commit is contained in:
Roberto I
2025-11-08 11:43:42 -03:00
parent f791bb6906
commit e44f3a2ffc
13 changed files with 87 additions and 9 deletions

View File

@@ -166,9 +166,9 @@ local function expand (n,s)
e, s, expand(n-1,s), e)
end
G=0; collectgarbage(); a =collectgarbage("count")
G=0; collectgarbage()
load(expand(20,"G=G+1"))()
assert(G==20); collectgarbage(); -- assert(gcinfo() <= a+1)
assert(G==20); collectgarbage()
G = nil
testamem("running code on new thread", function ()