From d917b2e1c91db476c5464f24c8b199969ad65b1c Mon Sep 17 00:00:00 2001 From: Gabriel Ozouf Date: Wed, 2 Sep 2020 11:13:06 +0200 Subject: [PATCH] [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 --- poincare/src/unit_convert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poincare/src/unit_convert.cpp b/poincare/src/unit_convert.cpp index 995798561..e38bef1fe 100644 --- a/poincare/src/unit_convert.cpp +++ b/poincare/src/unit_convert.cpp @@ -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); }