Warning on compare to `nil` in short-circuited query
I have a query with an expression like this:
This gives a warning about comparing to nil:
Is there a better way to implement this behaviour? If not, is it possible to detect that the check for
nil
is already performed in the query?13 Replies
Are you using the latest
ash
release? There was a bug around a very similar warning fix in the past couple weeks.
https://github.com/ash-project/ash/issues/2288GitHub
Warning: Comparing values with
nil
will always return false
. ·...Code of Conduct I agree to follow this project's Code of Conduct AI Policy I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue. Versions As...
Yes, I'm at 3.5.37
Was it released? It may only be in
main
Still getting the same error when using
main
According to the bug, it looks like you are on
ash 3.5.36
That bug report was from someone else
@Rutgerdj if you can put together a reproduction and comment on that existing issue or open a new one that would be great
I'll look into it.
Actually when do you get that warning?
Will do
Can I see the stacktrace?
apply_mt_date_filters
:
Got it
in this case
my earlier PR won't affect this
This is detecting a nil expression while building it directly
I see, so it just can't figure out the
is_nil()
check in an expression outside of the current comparison?Not currently, no
It figures it out when the value is something like
^arg(:whatever)
which you can't use in this contextThanks for the insights!