refactor(library/type_context): rename set_context to set_local_instances

This commit is contained in:
Leonardo de Moura 2015-11-04 11:29:34 -08:00
parent fb7efa9337
commit aa697206e8
5 changed files with 13 additions and 13 deletions

View file

@ -515,7 +515,7 @@ optional<expr> app_builder::mk_eq_drec(expr const & C, expr const & H1, expr con
return m_ptr->mk_eq_drec(C, H1, H2);
}
void app_builder::set_context(list<expr> const & ctx) {
m_ptr->m_ctx->set_context(ctx);
void app_builder::set_local_instances(list<expr> const & insts) {
m_ptr->m_ctx->set_local_instances(insts);
}
}

View file

@ -105,11 +105,11 @@ public:
because eq.rec is a dependent eliminator in HoTT. */
optional<expr> mk_eq_drec(expr const & C, expr const & H1, expr const & H2);
/** \brief Set the local context. This method is relevant when we want to expose local class instances
/** \brief Set the local instances. This method is relevant when we want to expose local class instances
to the app_builder.
\remark When the constructor app_builder(std::unique_ptr<tmp_type_context> && ctx) is used
the initialization can be performed outside. */
void set_context(list<expr> const & ctx);
void set_local_instances(list<expr> const & insts);
};
}

View file

@ -392,7 +392,7 @@ public:
void init_state(goal const & g) {
m_curr_state = to_state(g);
// TODO(Leo): set local context for type class resolution at tctx
// TODO(Leo): set local instances for type class resolution at tctx
}
optional<expr> operator()(goal const & g) {

View file

@ -98,10 +98,10 @@ type_context::type_context(environment const & env, io_state const & ios, bool m
type_context::~type_context() {
}
void type_context::set_context(list<expr> const & ctx) {
void type_context::set_local_instances(list<expr> const & insts) {
clear_cache();
m_ci_local_instances.clear();
for (expr const & e : ctx) {
for (expr const & e : insts) {
if (auto cname = is_class(infer(e))) {
m_ci_local_instances.push_back(mk_pair(*cname, e));
}
@ -1660,14 +1660,14 @@ type_context::scope_pos_info::~scope_pos_info() {
}
default_type_context::default_type_context(environment const & env, io_state const & ios,
list<expr> const & ctx, bool multiple_instances):
list<expr> const & insts, bool multiple_instances):
type_context(env, ios, multiple_instances),
m_not_reducible_pred(mk_not_reducible_pred(env)) {
m_ignore_if_zero = false;
m_next_local_idx = 0;
m_next_uvar_idx = 0;
m_next_mvar_idx = 0;
set_context(ctx);
set_local_instances(insts);
}
default_type_context::~default_type_context() {}

View file

@ -210,7 +210,7 @@ public:
type_context(environment const & env, io_state const & ios, bool multiple_instances = false);
virtual ~type_context();
void set_context(list<expr> const & ctx);
void set_local_instances(list<expr> const & insts);
environment const & env() const { return m_env; }
@ -361,10 +361,10 @@ public:
\remark We assume pretty-printing options are irrelevant. */
bool update_options(options const & opts);
/** \brief Return true if the local instances at \c ctx are compatible with the ones
/** \brief Return true if the local instances at \c insts are compatible with the ones
in the type inference object. This method is used to decide whether a type inference
object can be reused by the elaborator. */
bool compatible_local_instances(list<expr> const & ctx);
bool compatible_local_instances(list<expr> const & insts);
/** \brief Auxiliary object used to set position information for the type class resolution trace. */
class scope_pos_info {
@ -420,7 +420,7 @@ class default_type_context : public type_context {
public:
default_type_context(environment const & env, io_state const & ios,
list<expr> const & ctx = list<expr>(), bool multiple_instances = false);
list<expr> const & insts = list<expr>(), bool multiple_instances = false);
virtual ~default_type_context();
virtual bool is_extra_opaque(name const & n) const { return m_not_reducible_pred(n); }
virtual bool ignore_universe_def_eq(level const & l1, level const & l2) const;