-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expression evaluate issue #500
Comments
Thanks for taking the time to report this issue! |
I have updated the example – style is now included inside and it is possible to play with it. I have also tried to apply some style to see how it is overlapped, it should be clearer that black circles have red circles beneath. |
If you'd like to look into it, there are elaborated expression tests in this repo and you should be able to create some tests for this scenario and test it to see if the behavior, once a test is in place I think it might be simple to fix it. |
My initial guess is that the "deprecated" expression parser is simply being less strict about type checking. I think in both examples it would be preferable to swap the order to check if the value exists first. |
Is there a specific reason why it would be better to swap order if |
I have just tested the expression with following test and it pass as expected (same result for flipped order):
but I'm not sure what should be the fourth output, for the |
I haven't verified this, but I would expect "any" to use short-circuit evaluation. Basically, no need to keep running through all the checks if only one needs to pass. |
That's true, but first expression from the example with But yes, it makes sense to put |
If the value is not there, then it is (apparently) comparing whether So, I think the bug is really that the deprecated syntax isn't throwing a validation error when it should be. |
Describe the bug
Valid expression syntax does not select all objects and throws a warning.
To Reproduce
This simple example shows two layers:
first layer with red circles has applied this filter with deprecated syntax:
and second and the last layer with black circles has applied this filter:
These filters should be evaluated equally and should select same objects, but as you can see, the second filter selects just few objects and it throws this warning: Expected value to be of type number, but found null instead.
Expected behavior
The expression syntax should select same objects as the deprecated syntax.
Screenshots
Red circles are those objects with not defined
level
feature key and should be selected via the["!", ["has", "level"]]
expression.Desktop
Additional context
For some reason the
!
is not applied and only objects with definedlevel
feature key are selected.Important: if the negation expression is placed before the
>
operator it works as expected. But I remember that this order hadn't worked few months ago, but I cannot remember what version it was.The text was updated successfully, but these errors were encountered: