The good old "Condition ... is always false" Warning
已回答
I know. Not a new topic at all. However, I am not after advise how to suppress the warning. But I would like to understand why it is occurring in the first place.
fun Float.someFunction() {
if(this > 0f) {"doSomething"}
}
This gives the well known warning 'Condition 'this > 0f' is always false '. This is in my - possibly naive - understanding obviously wrong.
What happens under hood that leads the compiler to this conclusion? Is there some simple way to explain it?
请先登录再写评论。
It's possible that your IDE is working with some outdated or corrupted cache, which might confuse the analysis engine. I suggest trying this:
File → Cache Recovery → Repair IDE
If the warning is still there, register ian ssue in Kthe TIJ project: https://youtrack.jetbrains.com/issues
It's possible that your IDE is working with some outdated or corrupted cache, which might confuse the analysis engine. I suggest trying this:
File → Cache Recovery → Repair IDE
If the warning is still there, register ian ssue in Kthe TIJ project: https://youtrack.jetbrains.com/issues
I did that and it did not help.
I managed to enter an issue here: https://youtrack.jetbrains.com/newIssue?draftId=25-6761136 .
However, it is in state “DRAFT”. I fail to see how I can actually submit it. The “Create” Button is always grayed out. Apparently some inpute field hasn't been filled in or something.
OMG! I took the leading “Summary” text in the form as title and the rest of the form IS the summary. Didn't realize that it is an input field. My bad.
I have submitted the issue now.
And we can close this thread now. The problem went away after upgrading to the 2025.2 version.
See my last comment in https://youtrack.jetbrains.com/issue/KTIJ-35329/Erroneous-Condition-...-is-always-false-Warning