mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
[java-dfa] IDEA-309609 False "Condition is always false" - on negative number division with remainder
GitOrigin-RevId: bf71558ca9b2c9631e2dcc793abc9c16f17d630f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c1f3ea580a
commit
c0bcf113b3
@@ -1,4 +1,9 @@
|
||||
public class ModRange {
|
||||
// IDEA-309609
|
||||
boolean negativeNumber(int a) {
|
||||
return a >= 0 && (-11 % a == -2);
|
||||
}
|
||||
|
||||
void testMult(int x, int y, boolean b) {
|
||||
if (<warning descr="Condition 'x * 2 == y * 2 + 1' is always 'false'">x * 2 == y * 2 + 1</warning>) {}
|
||||
if (x * 3 == y * 3 + 1) {} // possible through overflow
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ public final class DfaBinOpValue extends DfaValue {
|
||||
@NotNull LongRangeSet divisorRange) {
|
||||
if (divisorRange.min() > 0) {
|
||||
// a % b where 0 <= a < b
|
||||
if (dividendRange.min() > -divisorRange.max() &&
|
||||
if (dividendRange.min() > -divisorRange.max() && dividendRange.max() >= 0 &&
|
||||
(dividendRange.max() < divisorRange.min() || state.getRelation(dividend, divisor) == RelationType.LT)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user