fix(library/scope): bug in end_scope procedure

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-06-02 10:43:28 -07:00
parent 6e113206b6
commit e56307f006
2 changed files with 27 additions and 2 deletions

View file

@ -413,8 +413,7 @@ environment end(environment const & env) {
(*p)(ctx);
ctx.clear_deps();
}
ext.m_sections = tail(ext.m_sections);
return update(ctx.env(), ext);
return ctx.env();
}}
lean_unreachable(); // LCOV_EXCL_LINE
}

26
tests/lua/sect5.lua Normal file
View file

@ -0,0 +1,26 @@
local env = environment()
env = env:begin_section_scope()
env = env:begin_section_scope()
env = env:add_global_level("l")
local l = mk_global_univ("l")
env = env:add(check(env, mk_var_decl("A", mk_sort(l))), binder_info(true))
env = env:add(check(env, mk_var_decl("B", mk_sort(l))), binder_info(true))
local A = Const("A")
local list = Const("list")
env = add_inductive(env,
"list", mk_sort(max_univ(l, 1)),
"nil", list,
"cons", mk_arrow(A, list, list))
print(env:find("list_rec"):type())
assert(env:find("cons"):type() == mk_arrow(A, list, list))
env = env:end_scope()
print(env:find("list_rec"):type())
print(env:find("cons"):type())
local l = mk_param_univ("l")
local A = Local("A", mk_sort(l))
local list = Const("list", {l})
assert(env:find("cons"):type() == Pi({A}, mk_arrow(A, list(A), list(A))))
env = env:end_scope()
print(env:find("list_rec"):type())
print(env:find("cons"):type())