diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 361af0cb4..40329a08e 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -350,7 +350,7 @@ Expression Expression::defaultHandleUnitsInChildren() { // Generically, an Expression does not accept any Unit in its children. const int childrenCount = numberOfChildren(); for (int i = 0; i < childrenCount; i++) { - if (childAtIndex(i).hasUnit()) { + if (!childAtIndex(i).extractUnits().isUninitialized()) { return replaceWithUndefinedInPlace(); } } diff --git a/poincare/src/power.cpp b/poincare/src/power.cpp index 576820dc9..9d9ee0a62 100644 --- a/poincare/src/power.cpp +++ b/poincare/src/power.cpp @@ -392,7 +392,7 @@ Expression Power::shallowReduce(ExpressionNode::ReductionContext reductionContex // Step 1: Handle the units { - if (index.hasUnit()) { + if (!index.extractUnits().isUninitialized()) { // There must be no unit in the exponent return replaceWithUndefinedInPlace(); } diff --git a/poincare/src/unit_convert.cpp b/poincare/src/unit_convert.cpp index 8a448af0e..148897ef5 100644 --- a/poincare/src/unit_convert.cpp +++ b/poincare/src/unit_convert.cpp @@ -59,7 +59,7 @@ Expression UnitConvert::shallowReduce(ExpressionNode::ReductionContext reduction // Divide the left member by the new unit Expression division = Division::Builder(childAtIndex(0), finalUnit.clone()); division = division.reduce(reductionContext); - if (division.hasUnit()) { + if (!division.extractUnits().isUninitialized()) { // The left and right members are not homogeneous return replaceWithUndefinedInPlace(); }