[apps/poincare] Use symbolicComputation in recursivelyMatches

This fixes a failed assertion for the scenario:
[3]->x then, in the Equation app, solve x+1->0
This commit is contained in:
Léa Saviot
2020-06-15 15:39:04 +02:00
parent 1f0b3770e3
commit cf4eaa3d1f
14 changed files with 49 additions and 25 deletions

View File

@@ -15,7 +15,7 @@ using namespace Shared;
namespace Solver {
bool Equation::containsIComplex(Context * context) const {
return expressionClone().recursivelyMatches([](const Expression e, Context * context) { return e.type() == ExpressionNode::Type::Constant && static_cast<const Constant &>(e).isIComplex(); }, context, true);
return expressionClone().recursivelyMatches([](const Expression e, Context * context) { return e.type() == ExpressionNode::Type::Constant && static_cast<const Constant &>(e).isIComplex(); }, context);
}
Expression Equation::Model::standardForm(const Storage::Record * record, Context * context, bool replaceFunctionsButNotSymbols) const {
@@ -44,8 +44,7 @@ Expression Equation::Model::standardForm(const Storage::Record * record, Context
[](const Expression e, Context * context) {
return e.type() == ExpressionNode::Type::Undefined || e.type() == ExpressionNode::Type::Infinity || Expression::IsMatrix(e, context);
},
contextToUse,
true))
contextToUse))
{
*returnedExpression = Undefined::Builder();
} else if (expressionRed.type() == ExpressionNode::Type::Equal) {

View File

@@ -156,7 +156,7 @@ EquationStore::Error EquationStore::privateExactSolve(Poincare::Context * contex
}
const Expression e = eq->standardForm(context, replaceFunctionsButNotSymbols); // The standard form is memoized so there is no double computation even if replaceFunctionsButNotSymbols is true.
if (e.isUninitialized() || e.type() == ExpressionNode::Type::Undefined) {
if (e.isUninitialized() || e.type() == ExpressionNode::Type::Undefined || e.recursivelyMatches(Expression::IsMatrix, context, replaceFunctionsButNotSymbols ? ExpressionNode::SymbolicComputation::ReplaceDefinedFunctionsWithDefinitions : ExpressionNode::SymbolicComputation::ReplaceAllDefinedSymbolsWithDefinition)) {
return Error::EquationUndefined;
}
if (e.type() == ExpressionNode::Type::Unreal) {