lean4-htt/src/library/equations_compiler
Leonardo de Moura 53667dd602 fix(library): change API and make sure we don't crash when searching for a non existing local decl
Fixes #1363

After error recovery has been implemented in the elaborator, a few
assumptions made in the type context are not valid anymore since we may
be recovering from errors, and the local and metavariable contexts may
be invalid.

I used the approach used in the class environment.

- find* methods return optional<...>
- get* methods throw exception for unknown elements

Remarks:

I preserved code patterns such as

     optional<local_decl> d = lctx.find_local_decl(...)
     lean_assert(d)

and did not convert them into

     local_decl d = lctx.get_local_decl(...)

Reason: the intention is clear that the local must be defined there.
If it is not we should analyze the problem and decide whether we should
throw an exception or not.

However, I converted code patterns such as

    local_decl d = *lctx.find_local_decl(...)

into

    local_decl d = lctx.get_local_decl(...)

Disclaimer: this change fixes issue #1363, but it may obfuscate other bugs.
2017-02-07 09:38:19 -08:00
..
CMakeLists.txt chore(library/equations_compiler): remove old equation compiler 2016-09-19 17:13:30 -07:00
compiler.cpp fix(library): change API and make sure we don't crash when searching for a non existing local decl 2017-02-07 09:38:19 -08:00
compiler.h feat(library/equations_compiler/elim_match): refactor 'program' structure 2016-08-18 14:17:49 -07:00
elim_match.cpp fix(library): change API and make sure we don't crash when searching for a non existing local decl 2017-02-07 09:38:19 -08:00
elim_match.h feat(library/equations_compiler): add mk_nonrec 2016-09-08 14:09:05 -07:00
equations.cpp feat(library/equations_compiler): add flag for marking equations that we should not report an error if they are not used 2017-02-05 19:26:45 -08:00
equations.h feat(library/equations_compiler): add flag for marking equations that we should not report an error if they are not used 2017-02-05 19:26:45 -08:00
init_module.cpp feat(library/equations_compiler): use defeq simplifier to cleanup types of automatically synthesized lemmas 2016-08-31 15:54:03 -07:00
init_module.h
pack_domain.cpp refactor(library): rename pr1/pr2 ==> fst/snd 2016-09-21 09:48:39 -07:00
pack_domain.h refactor(library/equations_compiler): move pack_domain to new module 2016-08-15 08:22:23 -07:00
structural_rec.cpp feat(frontends/lean): (Type u) can't be a proposition 2017-01-30 11:54:00 -08:00
structural_rec.h feat(library/equations_compiler/structural_rec): generate brec_on-based function 2016-08-29 15:58:13 -07:00
unbounded_rec.cpp feat(library/equations_compiler): add support for meta_definitions 2016-09-18 10:52:38 -07:00
unbounded_rec.h feat(library/equations_compiler): add support for meta_definitions 2016-09-18 10:52:38 -07:00
util.cpp feat(frontends/lean/elaborator): add pattern validator in the elaborator 2017-02-04 19:00:20 -08:00
util.h feat(frontends/lean/elaborator): add pattern validator in the elaborator 2017-02-04 19:00:20 -08:00