On Wed, 20 Oct 2021 09:11:27 -0700 Kalesh Singh kaleshsingh@google.com wrote:
The main reason for this is that it's predictable behavior form the user's perspective. Before this patch the recursion always walked down a single branch so limiting by level worked out the same as limiting by sub expressions and is in line with the error the user would see ("Too many sub-expressions (3 max)"). Now that we take multiple paths in the recursion, using the level to reflect the number of sub-expressions would lead to only seeing the error in some of the cases (Sometimes we allow 4, 5, 6 sub-expressions depending on how balanced the tree is, and sometimes we error out on 4 - when the tree is list-like). Limiting by sub-expression keeps this consistent (always error out if we have more than 3 sub-expressions) and is in line with the previous behavior.
I'm fine with that. If we want to improve this in the future then fine. We can always extend, as that doesn't break user API.
So we can keep it as is.
-- Steve