2013-11-12 04:53:23 +00:00
|
|
|
S1 = State()
|
|
|
|
S2 = State()
|
|
|
|
code = [[
|
|
|
|
function f(env, prefix, num, type)
|
2014-05-20 17:41:36 +00:00
|
|
|
local r = list_certified_declaration()
|
2013-11-12 04:53:23 +00:00
|
|
|
for i = 1, num do
|
2014-05-20 17:41:36 +00:00
|
|
|
r = list_certified_declaration(type_check(env, mk_var_decl(prefix .. "_" .. i, type)), r)
|
2013-11-12 04:53:23 +00:00
|
|
|
end
|
2014-05-09 01:52:15 +00:00
|
|
|
return r
|
2013-11-12 04:53:23 +00:00
|
|
|
end
|
|
|
|
]]
|
|
|
|
S1:dostring(code)
|
|
|
|
S2:dostring(code)
|
2014-05-21 18:24:24 +00:00
|
|
|
local e = bare_environment()
|
2014-05-09 01:52:15 +00:00
|
|
|
e = add_decl(e, mk_var_decl("N", Type))
|
2013-11-12 04:53:23 +00:00
|
|
|
code2 = [[
|
|
|
|
e, prefix = ...
|
2014-05-09 01:52:15 +00:00
|
|
|
return f(e, prefix, 1000, Const("N"))
|
2013-11-12 04:53:23 +00:00
|
|
|
]]
|
|
|
|
T1 = thread(S1, code2, e, "x")
|
|
|
|
T2 = thread(S2, code2, e, "y")
|
2014-05-09 01:52:15 +00:00
|
|
|
local r1 = T1:wait()
|
|
|
|
local r2 = T2:wait()
|
|
|
|
while not r1:is_nil() do
|
|
|
|
e = e:add(r1:car())
|
|
|
|
r1 = r1:cdr()
|
|
|
|
end
|
|
|
|
while not r2:is_nil() do
|
|
|
|
e = e:add(r2:car())
|
|
|
|
r2 = r2:cdr()
|
|
|
|
end
|
|
|
|
assert(e:find("x_" .. 10))
|
|
|
|
assert(e:find("y_" .. 100))
|