fix dfa false positive in JSTypeofTypeImpl

This commit is contained in:
peter
2013-09-17 17:49:57 +04:00
parent 0a8c1283a9
commit 88df6b0e2b
3 changed files with 26 additions and 2 deletions
@@ -25,7 +25,6 @@
package com.intellij.codeInspection.dataFlow.value;
import com.intellij.codeInspection.dataFlow.Nullness;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiKeyword;
import com.intellij.psi.PsiType;
@@ -109,7 +108,7 @@ public class DfaTypeValue extends DfaValue {
}
private boolean hardEquals(DfaTypeValue aType) {
return Comparing.equal(myCanonicalText, aType.myCanonicalText) && myNullness == aType.myNullness;
return myCanonicalText.equals(aType.myCanonicalText) && myNullness == aType.myNullness && myType.equals(aType.myType);
}
public boolean isAssignableFrom(DfaTypeValue dfaType) {
@@ -0,0 +1,24 @@
import org.jetbrains.annotations.NotNull;
interface JSType {
}
class JSTypeofTypeImpl implements JSType {
static final JSType NO_TYPE = new JSType() {
};
private JSType myEvaluatedType;
private void evaluateType() {
JSType exprType = JSResolveUtil.getExpressionJSType();
if (exprType instanceof JSTypeofTypeImpl) {
}
myEvaluatedType = NO_TYPE;
}
}
class JSResolveUtil {
@NotNull
public static JSType getExpressionJSType() {
return JSTypeofTypeImpl.NO_TYPE;
}
}
@@ -294,6 +294,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testUnconditionalForLoop() { doTest(); }
public void testAnonymousMethodIndependence() { doTest(); }
public void testAnonymousFieldIndependence() { doTest(); }
public void testNoConfusionWithAnonymousConstantInitializer() { doTest(); }
public void _testNullCheckBeforeInstanceof() { doTest(); }
}