lean4-htt/src/frontends/lean
Leonardo de Moura 85092412c7 refactor: remove Expr.FVar hack
@Kha @dselsam:
This hack was preventing us from making `Expr` a "real" Lean type.
This was bad for a few reasons:
- It was hard to extend/modify `Expr` in Lean since we would also have
to modify the C++ code that creates the `Expr` objects with the hidden
fields.
- `Expr.lam` and `Expr.forallE` were not following the Lean layout
standard where we sort fields by size. @Kha: recall we used that to
avoid a UB. The issue with `Expr.lam` and `Expr.forallE` is that they
have a "visible" field (`BinderInfo`), which is smaller than
hidden fields such as hash code.
- `Expr.fvar` had only one field at `Expr.lean,` but four behind the
scenes.

I added a new constructor `Local` that is only accessible from C++.
It is only used in legacy code we inherited from Lean2.
We will eventually delete it.

This refactoring was quite painful since many parts of the codebase
were mixing the new `Expr.fvar` with the old `Expr.local`.
I doubt I would be able to do it without the new staging framework
@Kha built.

BTW, some of the patches are horrible. I didn't care much since we
are going to deleted the super ugly files. That being said,
you should expect new weird bevaior due to `Expr.fvar` vs `Expr.local`.

Next step: use the new `ExprCachedData` to make all `Expr` hidden visibles
accessible from Lean.

checkpoint
2019-11-15 14:04:26 -08:00
..
brackets.cpp chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
brackets.h
builtin_cmds.cpp chore: temporary hack 2019-11-11 11:30:22 -08:00
builtin_cmds.h
builtin_exprs.cpp feat: add trace! macro 2019-10-22 16:08:37 -07:00
builtin_exprs.h chore(frontends/lean): remove tactic notation 2018-08-23 13:44:52 -07:00
choice.cpp chore(frontends/lean/choice): cleanup 2018-06-18 15:29:21 -07:00
choice.h refactor(frontends/lean/choice): use mdata to implement choice 2018-06-18 14:21:11 -07:00
CMakeLists.txt chore: remove dead code 2019-11-14 15:24:18 -08:00
cmd_table.h chore(frontends/lean): fix clang++ warnings at C++ 2019-01-30 15:19:34 -08:00
decl_attributes.cpp feat: allow attributes to be applied before elaboration 2019-11-13 15:40:19 -08:00
decl_attributes.h feat: allow attributes to be applied before elaboration 2019-11-13 15:40:19 -08:00
decl_cmds.cpp fix: syntax for universe parameters in axiom 2019-10-08 18:11:37 +02:00
decl_cmds.h feat(frontends/lean, library/init/lean): opaque constants 2019-03-15 17:41:44 -07:00
decl_util.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
decl_util.h feat(frontends/lean): add simple parser! macro 2019-06-24 15:48:11 -07:00
definition_cmds.cpp feat: allow attributes to be applied before elaboration 2019-11-13 15:40:19 -08:00
definition_cmds.h feat(library/init/lean/elaborator,frontends/lean/vm_elaborator): implement def/theorem/abbreviation 2019-01-12 15:10:00 +01:00
elaborator.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
elaborator.h chore(frontends/lean/elaborator): remove recover_expr_from_exception 2019-08-14 14:20:15 -07:00
inductive_cmds.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
inductive_cmds.h fix(frontends/lean/inductive_cmds): set m_explicit_levels, and call collect_implicit_locals only after that 2019-01-15 16:47:28 +01:00
init_module.cpp chore(frontends/lean): delete lean_environment 2019-05-13 13:05:04 -07:00
init_module.h
json.cpp refactor(library/messages): make an object_ref 2018-09-11 13:55:25 -07:00
json.h
local_context_adapter.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
local_context_adapter.h
local_decls.h
local_level_decls.h
match_expr.cpp feat(library/init): use new "empty match" syntax 2019-07-15 16:25:14 -07:00
match_expr.h feat(frontends/lean): add new "empty/no match" syntax to old parser 2019-07-15 16:18:44 -07:00
notation_cmd.cpp chore(frontends/lean): compilation warnings 2019-06-27 08:00:48 -07:00
notation_cmd.h chore(frontends/lean): fix clang++ warnings at C++ 2019-01-30 15:19:34 -08:00
parse_table.cpp feat(library,frontends/lean): use mdata instead of hacky cache for position information in preterms 2018-09-02 18:08:41 -07:00
parse_table.h chore(frontends/lean): fix clang++ warnings at C++ 2019-01-30 15:19:34 -08:00
parser.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
parser.h chore(frontends/lean): remove allow_field_notation = false setting 2019-07-17 19:09:15 -07:00
parser_config.cpp feat(kernel/environment): environment as a Lean object 2019-05-13 12:41:33 -07:00
parser_config.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
parser_pos_provider.h refactor(kernel): remove tag from kernel expressions 2018-06-08 10:29:22 -07:00
parser_state.h chore(frontends/lean): remove break_at_pos support 2018-09-07 08:34:19 -07:00
pp.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
pp.h refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
prenum.cpp feat(*): use new inductive datatype module 2018-09-06 18:09:22 -07:00
prenum.h feat(frontends/lean): remove prenum macro 2018-06-14 15:46:35 -07:00
print_cmd.cpp chore(library,frontends/lean): remove old attribute manager 2019-06-27 14:01:34 -07:00
print_cmd.h chore(frontends/lean): fix clang++ warnings at C++ 2019-01-30 15:19:34 -08:00
scanner.cpp feat(runtime, library/init/data/string/basic): add utf8_pos 2019-03-09 12:30:19 -08:00
scanner.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
simple_pos_info_provider.h feat(frontends/lean/vm_elaborator): recover from unknown identifiers 2019-02-07 14:16:28 +01:00
structure_cmd.cpp chore(frontends/lean): change explicit universe parameter notation in declarations 2019-07-02 08:57:08 -07:00
structure_cmd.h feat(frontends/lean/structure_cmd): implement structure 2019-01-15 15:01:52 +01:00
structure_instance.cpp feat(*): use new inductive datatype module 2018-09-06 18:09:22 -07:00
structure_instance.h
token_table.cpp feat: add trace! macro 2019-10-22 16:08:37 -07:00
token_table.h
tokens.cpp chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
tokens.h chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
tokens.txt chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
type_util.cpp chore(frontends/lean): compilation warnings 2019-06-27 08:00:48 -07:00
type_util.h chore(frontends/lean): fix clang++ warnings at C++ 2019-01-30 15:19:34 -08:00
typed_expr.cpp refactor(library/typed_expr): move typed_expr to frontends/lean 2018-04-09 15:25:40 -07:00
typed_expr.h refactor(library/typed_expr): move typed_expr to frontends/lean 2018-04-09 15:25:40 -07:00
util.cpp refactor(util/sexpr): move options and option_declarations to util 2019-05-16 14:37:24 -07:00
util.h refactor(util/sexpr/options): options as a Lean object 2019-05-16 14:27:44 -07:00