feat(library/abbreviation): store inverse map ignoring universe level parameters
This commit is contained in:
parent
0d96b6b4cb
commit
f47e1bed01
1 changed files with 4 additions and 3 deletions
|
@ -16,16 +16,17 @@ namespace lean {
|
||||||
typedef pair<name, bool> abbrev_entry;
|
typedef pair<name, bool> abbrev_entry;
|
||||||
|
|
||||||
struct abbrev_state {
|
struct abbrev_state {
|
||||||
name_map<bool> m_abbrevs;
|
name_map<bool> m_abbrevs;
|
||||||
rb_map<expr, name, expr_quick_cmp> m_inv_map; // for pretty printer
|
rb_map<expr, name, expr_cmp_no_level_params> m_inv_map; // for pretty printer
|
||||||
|
|
||||||
void add(environment const & env, name const & n, bool parsing_only) {
|
void add(environment const & env, name const & n, bool parsing_only) {
|
||||||
declaration const & d = env.get(n);
|
declaration const & d = env.get(n);
|
||||||
if (!d.is_definition())
|
if (!d.is_definition())
|
||||||
throw exception(sstream() << "invalid abbreviation '" << n << "', it is not a definition");
|
throw exception(sstream() << "invalid abbreviation '" << n << "', it is not a definition");
|
||||||
m_abbrevs.insert(n, parsing_only);
|
m_abbrevs.insert(n, parsing_only);
|
||||||
if (!parsing_only)
|
if (!parsing_only) {
|
||||||
m_inv_map.insert(d.get_value(), n);
|
m_inv_map.insert(d.get_value(), n);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_abbreviation(name const & n) const { return m_abbrevs.contains(n); }
|
bool is_abbreviation(name const & n) const { return m_abbrevs.contains(n); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue