Fix bug in the creation of children environments. Remove unnecessary function.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-09-17 07:37:33 -07:00
parent 30b19c314a
commit 9f9dcf9a29
4 changed files with 6 additions and 10 deletions

View file

@ -281,14 +281,14 @@ struct environment::imp {
/** \brief Add new axiom. */
void add_axiom(name const & n, expr const & t, environment const & env) {
check_name(n, env);
infer_universe(t, env);
m_type_checker.infer_universe(t);
register_named_object(mk_axiom(n, t));
}
/** \brief Add new variable. */
void add_var(name const & n, expr const & t, environment const & env) {
check_name(n, env);
infer_universe(t, env);
m_type_checker.infer_universe(t);
register_named_object(mk_var_decl(n, t));
}
@ -359,8 +359,8 @@ environment::environment():
}
// used when creating a new child environment
environment::environment(imp * new_ptr):
m_imp(new_ptr) {
environment::environment(std::shared_ptr<imp> const & parent, bool):
m_imp(new imp(parent, *this)) {
}
// used when creating a reference to the parent environment
@ -372,7 +372,7 @@ environment::~environment() {
}
environment environment::mk_child() const {
return environment(new imp(m_imp, *this));
return environment(m_imp, true);
}
bool environment::has_children() const {

View file

@ -21,6 +21,7 @@ private:
struct imp;
std::shared_ptr<imp> m_imp;
void check_type(name const & n, expr const & t, expr const & v);
environment(std::shared_ptr<imp> const & parent, bool);
explicit environment(std::shared_ptr<imp> const & ptr);
explicit environment(imp * new_ptr);
unsigned get_num_objects(bool local) const;

View file

@ -200,8 +200,4 @@ normalizer & type_checker::get_normalizer() { return m_ptr->get_normalizer(); }
expr infer_type(expr const & e, environment const & env, context const & ctx) {
return type_checker(env).infer_type(e, ctx);
}
level infer_universe(expr const & t, environment const & env, context const & ctx) {
return type_checker(env).infer_universe(t, ctx);
}
}

View file

@ -38,5 +38,4 @@ public:
};
expr infer_type(expr const & e, environment const & env, context const & ctx = context());
level infer_universe(expr const & t, environment const & env, context const & ctx = context());
}