[poincare/unit_convert] Fix improper reduction

In UnitConvert::shallowBeautify, an orphan expression would be reduced
without reaffecting the reduction's result. The reduction not being
taken into account would cause problem when handling undef values.
ex : Try to calculate i->_min

Change-Id: I4e53afa40ba838fed8c2fba9944c9c9ed1dc95b4
This commit is contained in:
Gabriel Ozouf
2020-09-02 11:13:06 +02:00
committed by Émilie Feral
parent 1995781a9f
commit d917b2e1c9

View File

@@ -94,7 +94,7 @@ Expression UnitConvert::shallowBeautify(ExpressionNode::ReductionContext reducti
}
Expression result = Multiplication::Builder(division, unit);
replaceWithInPlace(result);
result.shallowReduce(reductionContextWithoutUnits);
result = result.shallowReduce(reductionContextWithoutUnits);
return result.shallowBeautify(reductionContextWithoutUnits);
}