This commit fixes two issues with reset-assertions:
- pending pops were not done in SmtEngine, resulting in the following
assertion failure:
d_userLevels.size() == 0 && d_userContext->getLevel() == 1
- all definitions were erased on reset-assertion in an SMT2 file,
leading to errors about undefined types
}
void Smt2::resetAssertions() {
- this->Parser::reset();
+ // Remove all declarations except the ones at level 0.
+ while (this->scopeLevel() > 0) {
+ this->popScope();
+ }
}
void Smt2::setLogic(std::string name) {
void SmtEngine::resetAssertions() throw() {
SmtScope smts(this);
+ doPendingPops();
Trace("smt") << "SMT resetAssertions()" << endl;
if(Dump.isOn("benchmark")) {
issue1063-overloading-dt-sel.smt2 \
issue1063-overloading-dt-fun.smt2 \
non-fatal-errors.smt2 \
+ reset-assertions.smt2 \
sqrt2-sort-inf-unk.smt2 \
rec-fun-const-parse-bug.smt2
--- /dev/null
+; EXPECT: sat
+; EXPECT: sat
+(set-logic QF_ALL)
+(set-option :incremental true)
+(set-option :produce-models true)
+
+(declare-fun x () Real)
+(declare-fun y () Real)
+(assert (> x 0.0))
+(assert (> y 0.0))
+(assert (= (+ (* 2 x) y) 4))
+(check-sat)
+(reset-assertions)
+
+(declare-fun a () (Array Int Int))
+(assert (= (select a 4) 10))
+(check-sat)