Why is Intellij giving this hint? Does it prefer I...
# intellij
k
Why is Intellij giving this hint? Does it prefer I remove the
==
check, and just leave the
else
branch?
c
looks like a bug to me
h
Because it is always true 😄 No need for this branch, just drop it and use else.
k
What's confusing to me is that I can't leave the else branch out, I should be able to do that if it can determine that all the cases have been covered... I like having the
==
explicit for legibility reasons...
1
will take a look at the links! it's not a big deal after all
c
if the compiler already knows that its equivalent to an else it could allow this instead of the else. that would be perfect
a
Compiler doesn't know, the warning here is reported by "Constant conditions" IDEA inspection, which has a totally separate data-flow analysis engine. The feature request for the compiler would be https://youtrack.jetbrains.com/issue/KT-34753
👍 1