lean2/tests/lua/ty1.lua
Leonardo de Moura 926ed0a02d feat(lua): add type_inferer object to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 19:18:15 -08:00

12 lines
352 B
Lua

local env1 = environment()
local env2 = environment()
env1:add_var("N", Type())
env1:add_var("x", Const("N"))
env2:add_var("N", Type())
local x = Const("x")
local N = Const("N")
print(env1:infer_type(x))
local infer1 = type_inferer(env1)
local infer2 = type_inferer(env2)
assert(env1:infer_type(x) == infer1(x))
assert(env2:infer_type(N) == infer2(N))