mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DfaMemoryStateImpl#applyRelationCondition: use isSubRelation to match e.g. '!=' and '<' relations
Fixes IDEA-238619 Wrong warning in for-loop over float GitOrigin-RevId: 40b05cb62617bd6130852837463fc0dd061806a6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e3a81189cc
commit
a876bec99e
+1
-1
@@ -722,7 +722,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
}
|
||||
RelationType constantRelation = getFloatingConstantRelation(leftType, rightType);
|
||||
if (constantRelation != null) {
|
||||
return constantRelation == relationType;
|
||||
return relationType.isSubRelation(constantRelation);
|
||||
}
|
||||
if (canBeNaN(leftType) || canBeNaN(rightType)) {
|
||||
if (dfaLeft == dfaRight && dfaLeft instanceof DfaVariableValue && !(dfaLeft.getType() instanceof PsiPrimitiveType)) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
public class FloatLoop {
|
||||
void test() {
|
||||
for(float f = 0.0f; f != 2.0f; f += 0.01f){
|
||||
System.out.println(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -68,6 +68,7 @@ public class DataFlowRangeAnalysisTest extends DataFlowInspectionTestCase {
|
||||
public void testStringConcat() { doTest(); }
|
||||
public void testUnaryPlusMinus() { doTest(); }
|
||||
public void testWidenPlusInLoop() { doTest(); }
|
||||
public void testFloatLoop() { doTest(); }
|
||||
public void testWidenMulInLoop() { doTest(); }
|
||||
public void testReduceBinOpOnCast() { doTest(); }
|
||||
public void testSuppressZeroReport() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user