if (s.isConst() && i.isConst())
{
size_t len = Word::getLength(s);
- size_t pos = i.getConst<Rational>().getNumerator().toUnsignedInt();
- if (pos < len)
+ if (i.getConst<Rational>().sgn() != -1)
{
- std::vector<Node> elements = s.getConst<Sequence>().getVec();
- const Node& ret = elements[pos];
- return returnRewrite(node, ret, Rewrite::SEQ_NTH_EVAL);
+ size_t pos = i.getConst<Rational>().getNumerator().toUnsignedInt();
+ if (pos < len)
+ {
+ std::vector<Node> elements = s.getConst<Sequence>().getVec();
+ const Node& ret = elements[pos];
+ return returnRewrite(node, ret, Rewrite::SEQ_NTH_EVAL);
+ }
}
- else if (node.getKind() == SEQ_NTH_TOTAL)
+ if (node.getKind() == SEQ_NTH_TOTAL)
{
// return arbitrary term
Node ret = s.getType().getSequenceElementType().mkGroundValue();
regress1/strings/issue6653-4-rre.smt2
regress1/strings/issue6653-rre.smt2
regress1/strings/issue6653-rre-small.smt2
+ regress1/strings/issue6777-seq-nth-eval-cm.smt2
regress1/strings/kaluza-fl.smt2
regress1/strings/loop002.smt2
regress1/strings/loop003.smt2
--- /dev/null
+; COMMAND-LINE: -q
+; EXPECT: sat
+(set-logic ALL)
+(set-info :status sat)
+(set-option :strings-lazy-pp false)
+(set-option :check-unsat-cores true)
+(declare-fun b () (Seq Int))
+(declare-fun y () Int)
+(declare-fun l () Bool)
+(assert (distinct (seq.nth b y) (seq.nth b 1)))
+(assert (= l (> y 2)))
+(check-sat)