mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Process constant conditions inside NOT
Fixes IDEA-192521 Expect warning "Always true" when double compared to NaN and negated
This commit is contained in:
+1
-1
@@ -1891,7 +1891,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
@Override public void visitPrefixExpression(PsiPrefixExpression expression) {
|
||||
startElement(expression);
|
||||
|
||||
DfaValue dfaValue = myFactory.createValue(expression);
|
||||
DfaValue dfaValue = expression.getOperationTokenType() == JavaTokenType.EXCL ? null : myFactory.createValue(expression);
|
||||
if (dfaValue != null) {
|
||||
// Constant expression is computed: just push the result
|
||||
addInstruction(new PushInstruction(dfaValue, expression));
|
||||
|
||||
@@ -6,4 +6,9 @@ public class DoubleNaN {
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
|
||||
void test2() {
|
||||
System.out.println(<warning descr="Condition '1.0 == Double.NaN' is always 'false'">1.0 == Double.NaN</warning>);
|
||||
System.out.println(!(<warning descr="Condition '1.0 < Double.NaN' is always 'false'">1.0 < Double.NaN</warning>));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user