mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: type values shouldn't be part of equivalence relations (IDEA-135134)
This commit is contained in:
+3
@@ -267,6 +267,9 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
if (!canBeReused(dfaValue) && !(((DfaBoxedValue)dfaValue).getWrappedValue() instanceof DfaConstValue)) {
|
||||
return null;
|
||||
}
|
||||
if (dfaValue instanceof DfaTypeValue) {
|
||||
return null;
|
||||
}
|
||||
EqClass aClass = new EqClass(myFactory);
|
||||
aClass.add(dfaValue.getID());
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
class TestIDEAWarn {
|
||||
public int bar() {
|
||||
if (Foo.BAR == foo(0)) {
|
||||
return -1;
|
||||
}
|
||||
else if (Foo.BAR == foo(1)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private native Foo foo(int a);
|
||||
|
||||
enum Foo {
|
||||
FOO, BAR
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,6 +95,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testSwitchEnumConstant() { doTest(); }
|
||||
public void testEnumConstantNotNull() throws Throwable { doTest(); }
|
||||
public void testEqualsConstant() throws Throwable { doTest(); }
|
||||
public void testDontSaveTypeValue() { doTest(); }
|
||||
public void testFinalLoopVariableInstanceof() throws Throwable { doTest(); }
|
||||
public void testGreaterIsNotEquals() throws Throwable { doTest(); }
|
||||
public void testNotGreaterIsNotEquals() throws Throwable { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user