dfa: type values shouldn't be part of equivalence relations (IDEA-135134)

This commit is contained in:
peter
2015-01-13 17:11:50 +01:00
parent 9025725421
commit aa5b63d8d7
3 changed files with 26 additions and 0 deletions
@@ -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(); }