fix(frontends/lean): flyinfo for identifiers defined in sections

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-08-01 21:15:02 -07:00
parent 3795d466c1
commit 0465c6ef53

View file

@ -836,7 +836,7 @@ public:
}
if (!first) {
// we save the flyinfo data again for application of functions with strict implicit arguments
save_flyinfo_data(get_app_fn(e), f);
replace_flyinfo_data(get_app_fn(e), f);
}
}
expr d_type = binding_domain(f_type);
@ -887,16 +887,28 @@ public:
}
/** \brief Store the pair (pos(e), type(r)) in the flyinfo_data if m_flyinfo is true. */
void save_flyinfo_data(expr const & e, expr const & r) {
void save_flyinfo_data_core(expr const & e, expr const & r, bool replace) {
if (m_flyinfo && m_pos_provider && (is_constant(e) || is_local(e) || is_placeholder(e))) {
if (auto p = m_pos_provider->get_pos_info(e)) {
type_checker::scope scope(*m_tc[m_relax_main_opaque]);
expr t = m_tc[m_relax_main_opaque]->infer(r);
if (replace) {
while (!m_flyinfo_data.empty() && m_flyinfo_data.back().first == *p)
m_flyinfo_data.pop_back();
}
m_flyinfo_data.push_back(mk_pair(*p, t));
}
}
}
void save_flyinfo_data(expr const & e, expr const & r) {
save_flyinfo_data_core(e, r, false);
}
void replace_flyinfo_data(expr const & e, expr const & r) {
save_flyinfo_data_core(e, r, true);
}
expr visit_constant(expr const & e) {
auto it = m_cache.find(e);
if (it != m_cache.end()) {
@ -1269,12 +1281,11 @@ public:
instantiate_flyinfo(s);
optional<flyinfo_data> prev;
for (auto const & p : m_flyinfo_data) {
if (prev && p.first != prev->first)
display_flyinfo_data(*prev);
prev = p;
if (!prev || p.first != prev->first) {
display_flyinfo_data(p);
prev = p;
}
}
if (prev)
display_flyinfo_data(*prev);
}
std::tuple<expr, level_param_names> operator()(expr const & e, bool _ensure_type, bool relax_main_opaque) {