fix(library/module_mgr): do not crash on missing imports

Fixes #1506.
This commit is contained in:
Gabriel Ebner 2017-04-04 19:56:33 +02:00
parent c06bef0505
commit 01a7efc007
4 changed files with 9 additions and 9 deletions

View file

@ -2297,7 +2297,7 @@ void parser::process_imports() {
try {
std::rethrow_exception(e.m_ex);
} catch (throwable & t) {
parser_exception error((sstream() << "invalid import: " << e.m_import.m_name << "\n" << t.what()).str(),
parser_exception error((sstream() << "invalid import: " << e.m_import.m_name).str(),
m_file_name.c_str(), m_last_cmd_pos);
if (!m_use_exceptions && m_show_errors)
report_message(error);

View file

@ -83,7 +83,8 @@ static gtask compile_olean(std::shared_ptr<module_info const> const & mod, log_t
std::vector<gtask> olean_deps;
for (auto & dep : mod->m_deps)
olean_deps.push_back(dep.m_mod_info->m_olean_task);
if (dep.m_mod_info)
olean_deps.push_back(dep.m_mod_info->m_olean_task);
return add_library_task(task_builder<unit>([mod, errs] {
if (mod->m_source != module_src::LEAN)

View file

@ -4,12 +4,12 @@
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo\ncould not resolve import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: bar\ncould not resolve import: bar"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"}],"response":"all_messages"}
{"msgs":[{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'foo' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":1,"severity":"error","text":"file 'bar' not found in the LEAN_PATH"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: foo"},{"caption":"","file_name":"f","pos_col":0,"pos_line":17,"severity":"error","text":"invalid import: bar"}],"response":"all_messages"}
{"message":"file invalidated","response":"ok","seq_num":0}
{"response":"ok","seq_num":2}
{"prefix":"","response":"ok","seq_num":4}

View file

@ -1,6 +1,5 @@
missing_import.lean:1:0: error: file 'does/not/exist' not found in the LEAN_PATH
missing_import.lean:1:0: error: invalid import: does.not.exist
could not resolve import: does.not.exist
@[reducible]
def bitvec : → Type :=
λ (n : ), vector bool n