}
}
-Node EvalResult::toNode() const
+Node EvalResult::toNode(const TypeNode& tn) const
{
NodeManager* nm = NodeManager::currentNM();
switch (d_tag)
{
case EvalResult::BOOL: return nm->mkConst(d_bool);
case EvalResult::BITVECTOR: return nm->mkConst(d_bv);
- case EvalResult::RATIONAL: return nm->mkConst(CONST_RATIONAL, d_rat);
+ case EvalResult::RATIONAL:
+ Assert(!tn.isNull());
+ return nm->mkConstRealOrInt(tn, d_rat);
case EvalResult::STRING: return nm->mkConst(d_str);
case EvalResult::UVALUE: return nm->mkConst(d_av);
default:
}
}
Trace("evaluator") << "Run eval internal..." << std::endl;
- Node ret = evalInternal(n, args, vals, evalAsNode, results).toNode();
+ Node ret =
+ evalInternal(n, args, vals, evalAsNode, results).toNode(n.getType());
// if we failed to evaluate
if (ret.isNull() && d_rr != nullptr)
{
for (const auto& lambdaVal : currNode)
{
- lambdaVals.insert(lambdaVals.begin(), results[lambdaVal].toNode());
+ lambdaVals.insert(lambdaVals.begin(),
+ results[lambdaVal].toNode(lambdaVal.getType()));
}
// Lambdas are evaluated in a recursive fashion because each
}
case kind::CONST_RATIONAL:
+ case kind::CONST_INTEGER:
{
const Rational& r = currNodeVal.getConst<Rational>();
results[currNode] = EvalResult(r);
else
{
// otherwise, use the evaluation of the operator
- echildren.push_back(itr->second.toNode());
+ echildren.push_back(itr->second.toNode(op.getType()));
}
}
}
else
{
// otherwise, use the evaluation
- echildren.push_back(itr->second.toNode());
+ echildren.push_back(itr->second.toNode(currNodeChild.getType()));
}
}
// The value is the result of our (partially) successful evaluation