}
// is it an equivalence class with a seq.unit term?
Node assignedValue;
- if (nfe.d_nf[0].getKind() == SEQ_UNIT
- || nfe.d_nf[0].getKind() == STRING_UNIT)
+ if (nfe.d_nf[0].getKind() == STRING_UNIT)
+ {
+ // str.unit is applied to integers, where we are guaranteed the model
+ // exists. We preempitively get the model value here, so that we
+ // avoid repeated model values for strings.
+ Node val = d_valuation.getModelValue(nfe.d_nf[0][0]);
+ assignedValue = utils::mkUnit(eqc.getType(), val);
+ assignedValue = rewrite(assignedValue);
+ Trace("strings-model")
+ << "-> assign via str.unit: " << assignedValue << std::endl;
+ }
+ else if (nfe.d_nf[0].getKind() == SEQ_UNIT)
{
if (nfe.d_nf[0][0].getType().isStringLike())
{
regress1/strings/issue8434-nterm-str-rw.smt2
regress1/strings/issue8890-inj-oob.smt2
regress1/strings/issue8906-oob-exp.smt2
+ regress1/strings/issue8915-str-unit-model.smt2
regress1/strings/kaluza-fl.smt2
regress1/strings/loop002.smt2
regress1/strings/loop003.smt2
--- /dev/null
+; COMMAND-LINE: --strings-exp
+; EXPECT: sat
+(set-logic ALL)
+(declare-fun a () String)
+(declare-fun e () String)
+(declare-fun v () String)
+(assert (exists ((E String)) (and (distinct v e) (distinct e a) (distinct v "A") (> (str.to_code a) 65))))
+(check-sat)