Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - fix(checker/text_import): make leanchecker agree with external tc #574

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/checker/text_import.cpp
Expand Up @@ -52,6 +52,7 @@ struct text_importer {
while (in >> idx) {
ls.push_back(m_level.at(idx));
}
in.clear();
return to_list(ls);
}

Expand All @@ -61,6 +62,7 @@ struct text_importer {
while (in >> idx) {
ls.push_back(m_name.at(idx));
}
in.clear();
return to_list(ls);
}

Expand Down Expand Up @@ -224,6 +226,10 @@ struct text_importer {
} else {
throw exception(sstream() << "unknown command: " << cmd);
}
if (!in.eof()) in >> std::ws;
if (in.fail() || !in.eof()) {
throw exception(sstream() << "parse error");
}
}
};

Expand Down
6 changes: 0 additions & 6 deletions src/kernel/type_checker.cpp
Expand Up @@ -111,8 +111,6 @@ expr type_checker::infer_lambda(expr const & _e, bool infer_only) {
es.push_back(e);
ds.push_back(binding_domain(e));
expr d = instantiate_rev(binding_domain(e), ls.size(), ls.data());
if (binding_name(e).is_anonymous())
throw_kernel_exception(m_env, "invalid anonymous binder name", e);
expr l = mk_local(m_name_generator.next(), binding_name(e), d, binding_info(e));
ls.push_back(l);
if (!infer_only) {
Expand All @@ -135,8 +133,6 @@ expr type_checker::infer_pi(expr const & _e, bool infer_only) {
buffer<level> us;
expr e = _e;
while (is_pi(e)) {
if (binding_name(e).is_anonymous())
throw_kernel_exception(m_env, "invalid anonymous binder name", e);
expr d = instantiate_rev(binding_domain(e), ls.size(), ls.data());
expr t1 = ensure_sort_core(infer_type_core(d, infer_only), d);
us.push_back(sort_level(t1));
Expand Down Expand Up @@ -189,8 +185,6 @@ expr type_checker::infer_app(expr const & e, bool infer_only) {

expr type_checker::infer_let(expr const & e, bool infer_only) {
if (!infer_only) {
if (let_name(e).is_anonymous())
throw_kernel_exception(m_env, "invalid anonymous let var name", e);
ensure_sort_core(infer_type_core(let_type(e), infer_only), e);
expr v_type = infer_type_core(let_value(e), infer_only);
// TODO(Leo): we will remove justifications in the future.
Expand Down