a6116e3156
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
12 lines
350 B
Lua
12 lines
350 B
Lua
local env = environment()
|
|
local inferer = type_inferer(env)
|
|
env:add_var("N", Type())
|
|
local N = Const("N")
|
|
env:add_var("a", N)
|
|
local ctx = context()
|
|
ctx = extend(ctx, "x", N)
|
|
assert(inferer(Var(0), ctx) == N)
|
|
assert(not pcall(function() inferer(Var(1), ctx) end))
|
|
inferer:clear()
|
|
assert(inferer(Var(0), ctx) == N)
|
|
assert(is_type_inferer(inferer))
|