Allow more than 20 And operatrors.
This should succeed.
true && true && true && true && true &&
true && true && true && true && true &&
true && true && true && true && true &&
true && true && true && true && true &&
true && true && true && true && true &&
true && true && true && true && true &&
true && true && true && true && true &&
true && true && true && true && true
It's hitting protections for max nesting depth: Message:"Max call depth exceeded.
Note that arranging in flat form works:
And(
true,true,true,true,true,
true,true,true,true,true,
true,true,true,true,true,
true,true,true,true,true,
true,true,true,true,true,
true,true,true,true,true,
true,true,true,true,true,
true,true,true,true,true)
Can't hosts simply
new PowerFxConfig(...)
{
MaxCallDepth = NEW_MAX_NUMBER
}
The problem is that fundamentally, a && b && c shouldn't threaten a stack overflow.
This may help: https://github.com/microsoft/Power-Fx/blob/5132996c77c101f816a91e5a5e6287db6052e0ca/src/libraries/Microsoft.PowerFx.Core/IR/IRTranslator.cs#L600
I think similar optimization may help for all the operator that we convert to call node.
This is doable, but will require a breaking change to update TexlNode. The current node is a binary op with just left and right - which mandates a deep tree structure which makes us suspectable to stack overflows. We need to change to a new node that is flat.
So:
a+b+c+d
becomes this tree:
BinOp(BinOp(BinOp(a,b),c),d)
which is deep and recursive. We need a flatter structure:
BinOp(a,b,c,d)
Fixing this on Fx side is a too large of breaking change. Even after the breaking change to AST, every visitor needs to be updated
We have made a fix on the MCS side to use And() instead of &&