You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm incorporating this library into a project where I want to let users create formulas that check against certain fields. This is mostly working, but I've hit a small roadblock when trying to create a x exists suffix operator that basically checks x != nil. This generally works, but fails in certain nesting conditions.
It might have to do something with operator precedence, as changing the order fixes one case but then causes another test case to fail. I'd appreciate some feedback on how to fix this or how to debug this.
The strange thing is that it works fine perfectly if it's a prefix operator (didset X in my example), though I'd prefer the suffix variant.
Hi @nighthawk,
Thanks for reporting this issue, very useful finding!
I took some time reviewing the related code paths, looks like it's related to an issue with embedding expressions in parentheses. It is not a trivial fix, might take some more time, so I'm letting you know I'm working on a fix.
In the meantime, you are free to use prefix expressions with equivalent functionality - it's just the syntax that differs - which works as expected.
Status update: I managed to identify the issue. The expression "(toggle == true) and (url exists)" fails because the nested parentheses caused an issue, and the expression matcher only processes the string until the "(toggle == true) and (url" part, and not prioritizing the "url exists" expression.
Note: it works without the parentheses, if the suffix function "exists" has a higher priority than "and"
I'm incorporating this library into a project where I want to let users create formulas that check against certain fields. This is mostly working, but I've hit a small roadblock when trying to create a
x exists
suffix operator that basically checksx != nil
. This generally works, but fails in certain nesting conditions.It might have to do something with operator precedence, as changing the order fixes one case but then causes another test case to fail. I'd appreciate some feedback on how to fix this or how to debug this.
The strange thing is that it works fine perfectly if it's a prefix operator (
didset X
in my example), though I'd prefer the suffix variant.The full code sample is here, which is a minor modification of the code from the template example in this repo: https://gist.github.com/nighthawk/060475d0ded20788e9269054e152d76d
Any help would be much appreciated!
The text was updated successfully, but these errors were encountered: