mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
null types (IDEA-146740)
This commit is contained in:
+5
@@ -72,6 +72,11 @@ public class InferenceVariable extends LightTypeParameter {
|
||||
list = new ArrayList<PsiType>();
|
||||
myBounds.put(inferenceBound, list);
|
||||
}
|
||||
|
||||
if (classType == null) {
|
||||
classType = PsiType.NULL;
|
||||
}
|
||||
|
||||
final int idx = list.indexOf(classType);
|
||||
if (idx < 0) {
|
||||
list.add(classType);
|
||||
|
||||
+2
-2
@@ -72,8 +72,8 @@ public class TypeEqualityConstraint implements ConstraintFormula {
|
||||
}
|
||||
|
||||
if (session.isProperType(myT) && session.isProperType(myS)) {
|
||||
if (myT == null) return myS == null || myS.equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
|
||||
if (myS == null) return true;
|
||||
if (myT == null || myT == PsiType.NULL) return myS == null || myS == PsiType.NULL || myS.equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
|
||||
if (myS == null || myS == PsiType.NULL) return true;
|
||||
return Comparing.equal(myT, myS);
|
||||
}
|
||||
InferenceVariable inferenceVariable = session.getInferenceVariable(myS);
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
class Test {
|
||||
void foo(List<Set<String>> dictSeqs) {
|
||||
final Dict<String> dict = new Dict<>(dictSeqs.toArray(new Set[dictSeqs.size()]));
|
||||
final Dict<String> dict1 = new Dict<String>(dictSeqs.toArray(new Set[dictSeqs.size()]));
|
||||
}
|
||||
|
||||
static class Dict<K extends Comparable<K>> {
|
||||
public Dict(final Set<K>... sex) {}
|
||||
}
|
||||
}
|
||||
+4
@@ -55,6 +55,10 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNullTypesInDiamondsInference() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user