mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: types with wildcard parameters are not equal
This commit is contained in:
+2
-1
@@ -30,6 +30,7 @@ import com.intellij.codeInspection.dataFlow.Nullness;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -132,7 +133,7 @@ public class DfaVariableValue extends DfaValue {
|
||||
|
||||
private boolean hardEquals(PsiModifierListOwner psiVar, PsiType varType, boolean negated, DfaVariableValue qualifier) {
|
||||
return psiVar == myVariable &&
|
||||
Comparing.equal(varType, myVarType) &&
|
||||
Comparing.equal(TypeConversionUtil.erasure(varType), TypeConversionUtil.erasure(myVarType)) &&
|
||||
negated == myIsNegated &&
|
||||
(myQualifier == null ? qualifier == null : myQualifier.hardEquals(qualifier.getPsiVariable(), qualifier.getVariableType(),
|
||||
qualifier.isNegated(), qualifier.getQualifier()));
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Some {
|
||||
void bar2(@Nullable Iterable<? extends String> dirs) {
|
||||
if (dirs != null) {
|
||||
for (String dir : dirs) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -296,6 +296,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testAnonymousMethodIndependence() { doTest(); }
|
||||
public void testAnonymousFieldIndependence() { doTest(); }
|
||||
public void testNoConfusionWithAnonymousConstantInitializer() { doTest(); }
|
||||
public void testForeachOverWildcards() { doTest(); }
|
||||
|
||||
public void _testNullCheckBeforeInstanceof() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user