diff --git a/poincare/src/binomial_coefficient.cpp b/poincare/src/binomial_coefficient.cpp index be7a18477..343de9a9e 100644 --- a/poincare/src/binomial_coefficient.cpp +++ b/poincare/src/binomial_coefficient.cpp @@ -65,7 +65,9 @@ Expression BinomialCoefficient::shallowReduce(Context * context) { Expression c1 = childAtIndex(1); if (SortedIsMatrix(c0, context) || SortedIsMatrix(c1, context)) { - return Undefined::Builder(); + Expression result = Undefined::Builder(); + replaceWithInPlace(result); + return result; } if (c0.type() == ExpressionNode::Type::Rational) { diff --git a/poincare/src/confidence_interval.cpp b/poincare/src/confidence_interval.cpp index b9780e78e..db026ccd6 100644 --- a/poincare/src/confidence_interval.cpp +++ b/poincare/src/confidence_interval.cpp @@ -62,7 +62,9 @@ Expression ConfidenceInterval::shallowReduce(ExpressionNode::ReductionContext re Expression c0 = childAtIndex(0); Expression c1 = childAtIndex(1); if (SortedIsMatrix(c0, reductionContext.context()) || SortedIsMatrix(c1, reductionContext.context())) { - return Undefined::Builder(); + Expression result = Undefined::Builder(); + replaceWithInPlace(result); + return result; } if (c0.type() == ExpressionNode::Type::Rational) { Rational r0 = static_cast(c0); diff --git a/poincare/src/derivative.cpp b/poincare/src/derivative.cpp index d37027df3..52cb396ce 100644 --- a/poincare/src/derivative.cpp +++ b/poincare/src/derivative.cpp @@ -146,7 +146,9 @@ Expression Derivative::shallowReduce(Context * context) { || SortedIsMatrix(childAtIndex(1), context) || SortedIsMatrix(childAtIndex(2), context)) { - return Undefined::Builder(); + Expression result = Undefined::Builder(); + replaceWithInPlace(result); + return result; } // TODO: to be implemented diff(+) -> +diff() etc return *this; diff --git a/poincare/src/integral.cpp b/poincare/src/integral.cpp index 03efa8741..6542fe855 100644 --- a/poincare/src/integral.cpp +++ b/poincare/src/integral.cpp @@ -225,7 +225,9 @@ Expression Integral::shallowReduce(Context * context) { || SortedIsMatrix(childAtIndex(2), context) || SortedIsMatrix(childAtIndex(3), context)) { - return Undefined::Builder(); + Expression result = Undefined::Builder(); + replaceWithInPlace(result); + return result; } return *this; }