2014-05-21 18:24:24 +00:00
|
|
|
local env = bare_environment()
|
2014-07-22 16:43:18 +00:00
|
|
|
env = add_decl(env, mk_var_decl("or", mk_arrow(Prop, Prop, Prop)))
|
|
|
|
env = add_decl(env, mk_var_decl("A", Prop))
|
2014-05-15 19:23:07 +00:00
|
|
|
local Or = Const("or")
|
|
|
|
local A = Const("A")
|
|
|
|
local B = Const("B")
|
|
|
|
local tc = type_checker(env)
|
|
|
|
local F = Or(A, B)
|
2014-07-22 16:43:18 +00:00
|
|
|
assert(tc:infer(F) == Prop)
|
2014-05-15 19:23:07 +00:00
|
|
|
assert(not pcall(function()
|
|
|
|
-- The following test must fail since B is not
|
|
|
|
-- declared in env.
|
|
|
|
-- This test make sure that infer and check are
|
|
|
|
-- not sharing the same cache.
|
|
|
|
print(tc:check(F))
|
|
|
|
end
|
|
|
|
))
|