if (ArithMSum::isolate(uv, msum, veqc, slv, EQUAL) != 0)
{
Assert(!slv.isNull());
- // currently do not support substitution-with-coefficients
- if (veqc.isNull() && !expr::hasSubterm(slv, uv))
+ // Currently do not support substitution-with-coefficients.
+ // We also ensure types are correct here, which avoids substituting
+ // a term of non-integer type for a variable of integer type.
+ if (veqc.isNull() && !expr::hasSubterm(slv, uv)
+ && slv.getType().isSubtypeOf(uv.getType()))
{
Trace("nl-ext-cm")
<< "check-model-subs : " << uv << " -> " << slv << std::endl;