mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix dfa false positive in JSTypeofTypeImpl
This commit is contained in:
+1
-2
@@ -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) {
|
||||
|
||||
+24
@@ -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(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user