Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug in user-propagator "created" #5843

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api/c++/z3++.h
Original file line number Diff line number Diff line change
Expand Up @@ -3939,10 +3939,6 @@ namespace z3 {

Z3_solver_callback cb { nullptr };

context& ctx() {
return c ? *c : s->ctx();
}

struct scoped_cb {
user_propagator_base& p;
scoped_cb(void* _p, Z3_solver_callback cb):p(*static_cast<user_propagator_base*>(_p)) {
Expand Down Expand Up @@ -4005,6 +4001,10 @@ namespace z3 {

virtual ~user_propagator_base() = default;

context& ctx() {
return c ? *c : s->ctx();
}

/**
\brief user_propagators created using \c fresh() are created during
search and their lifetimes are restricted to search time. They should
Expand Down
5 changes: 3 additions & 2 deletions src/smt/theory_user_propagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ theory * theory_user_propagator::mk_fresh(context * new_ctx) {
if ((bool)m_final_eh) th->register_final(m_final_eh);
if ((bool)m_eq_eh) th->register_eq(m_eq_eh);
if ((bool)m_diseq_eh) th->register_diseq(m_diseq_eh);
if ((bool)m_created_eh) th->register_created(m_created_eh);
return th;
}

Expand Down Expand Up @@ -228,8 +229,8 @@ bool theory_user_propagator::internalize_term(app* term) {

add_expr(term);

if (!m_created_eh && (m_fixed_eh || m_eq_eh || m_diseq_eh))
throw default_exception("You have to register a created event handler for new terms if you track them");
if (!m_created_eh && (m_fixed_eh || m_eq_eh || m_diseq_eh))
return true;
if (m_created_eh)
m_created_eh(m_user_context, this, term);
return true;
Expand Down