mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Mark code like if(x > Double.NaN) as "always false"
Fixes part of IDEA-193102 x > Double.NaN comparison should be highlighted as always false
This commit is contained in:
+1
-4
@@ -441,10 +441,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
|
||||
|
||||
private boolean isEffectivelyNaN(@NotNull DfaValue dfaValue) {
|
||||
for (DfaValue eqClass : getEquivalentValues(dfaValue)) {
|
||||
if (isNaN(eqClass)) return true;
|
||||
}
|
||||
return false;
|
||||
return isNaN(dfaValue) || getEquivalentValues(dfaValue).stream().anyMatch(DfaMemoryStateImpl::isNaN);
|
||||
}
|
||||
|
||||
List<EqClass> getEqClasses() {
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
public class DoubleNaN {
|
||||
void testNanCmp(double x) {
|
||||
if (<warning descr="Condition 'x > Double.NaN' is always 'false'">x > Double.NaN</warning>) {
|
||||
return;
|
||||
}
|
||||
boolean cmp = x > Double.NaN; // this is always false, a warning is expected
|
||||
System.out.println(x > Double.NaN); // this is always false, a warning is expected
|
||||
}
|
||||
|
||||
void test() {
|
||||
double x = Double.NaN;
|
||||
double y = Double.NaN;
|
||||
|
||||
Reference in New Issue
Block a user