summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-11-07 09:55:38 -0800
committerAndres Noetzli <andres.noetzli@gmail.com>2018-11-07 09:55:38 -0800
commit9228ee9c599648edd8a58e9873d1318bc3536f9a (patch)
tree8534e13f961c4267ef36217c0a156c1236364ecb
parent8a7e611fb40bb96faf85c1532fa778c47d83a899 (diff)
Fix collectEmptyEqs in string rewriter
`TheoryStringsRewriter::collectEmptyEqs()` was not checking whether the input node is a conjunction if it is not an equality. This commitadds that check.
-rw-r--r--src/theory/strings/theory_strings_rewriter.cpp2
-rw-r--r--test/unit/theory/theory_strings_rewriter_white.h12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp
index 5ba9d6e3f..e94a23c87 100644
--- a/src/theory/strings/theory_strings_rewriter.cpp
+++ b/src/theory/strings/theory_strings_rewriter.cpp
@@ -4948,7 +4948,7 @@ std::pair<bool, std::vector<Node> > TheoryStringsRewriter::collectEmptyEqs(
allEmptyEqs = false;
}
}
- else
+ else if (x.getKind() == kind::AND)
{
for (const Node& c : x)
{
diff --git a/test/unit/theory/theory_strings_rewriter_white.h b/test/unit/theory/theory_strings_rewriter_white.h
index 87aef3704..42ac2cdd9 100644
--- a/test/unit/theory/theory_strings_rewriter_white.h
+++ b/test/unit/theory/theory_strings_rewriter_white.h
@@ -604,6 +604,18 @@ class TheoryStringsRewriterWhite : public CxxTest::TestSuite
b);
repl = d_nm->mkNode(kind::STRING_STRREPL, b, x, b);
sameNormalForm(repl_repl, repl);
+
+ // Different normal forms for:
+ //
+ // (str.replace "B" (str.replace "" x "A") "B")
+ //
+ // (str.replace "B" x "B")
+ repl_repl = d_nm->mkNode(kind::STRING_STRREPL,
+ b,
+ d_nm->mkNode(kind::STRING_STRREPL, empty, x, a),
+ b);
+ repl = d_nm->mkNode(kind::STRING_STRREPL, b, x, b);
+ differentNormalForms(repl_repl, repl);
}
void testRewriteContains()
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback