dfa: don't store useless primitive != null facts

This commit is contained in:
peter
2015-11-17 17:19:43 +01:00
parent 66b5456707
commit 6293695598
@@ -848,6 +848,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
}
else { // Not Equals
if (c1Index.equals(c2Index) || areCompatibleConstants(c1Index, c2Index)) return false;
if (isNull(dfaLeft) && isPrimitive(dfaRight) || isNull(dfaRight) && isPrimitive(dfaLeft)) return true;
makeClassesDistinct(c1Index, c2Index);
myCachedDistinctClassPairs = null;
myCachedHash = null;
@@ -856,6 +857,10 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
return true;
}
private static boolean isPrimitive(DfaValue value) {
return value instanceof DfaVariableValue && ((DfaVariableValue)value).getVariableType() instanceof PsiPrimitiveType;
}
private static boolean preserveConstantDistinction(final Object c1, final Object c2) {
return c1 == null && c2 instanceof PsiEnumConstant ||
c2 == null && c1 instanceof PsiEnumConstant;