mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 05:21:29 +07:00
provably distinct (IDEA-67682)
This commit is contained in:
@@ -36,8 +36,8 @@ public class TypesDistinctProver {
|
||||
}
|
||||
|
||||
protected static boolean provablyDistinct(PsiType type1, PsiType type2, int level) {
|
||||
if (type1 instanceof PsiClassType && ((PsiClassType)type1).resolve() instanceof PsiTypeParameter) return false;
|
||||
if (type2 instanceof PsiClassType && ((PsiClassType)type2).resolve() instanceof PsiTypeParameter) return false;
|
||||
if (type1 instanceof PsiClassType && ((PsiClassType)type1).resolve() instanceof PsiTypeParameter && level < 2) return false;
|
||||
if (type2 instanceof PsiClassType && ((PsiClassType)type2).resolve() instanceof PsiTypeParameter && level < 2) return false;
|
||||
if (type1 instanceof PsiWildcardType) {
|
||||
if (type2 instanceof PsiWildcardType) {
|
||||
return provablyDistinct((PsiWildcardType)type1, (PsiWildcardType)type2);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import java.util.List;
|
||||
|
||||
abstract class B {
|
||||
<T> void foo(List<List<String>[]> x) {
|
||||
Object y1 = <error descr="Inconvertible types; cannot cast 'java.util.List<java.util.List<java.lang.String>[]>' to 'java.util.List<java.util.List<T>[]>'">(List<List<T>[]>)x</error>;
|
||||
}
|
||||
|
||||
<T> void foo1(List<List<List<String>>[]> x) {
|
||||
Object y1 = <error descr="Inconvertible types; cannot cast 'java.util.List<java.util.List<java.util.List<java.lang.String>>[]>' to 'java.util.List<java.util.List<java.util.List<T>>[]>'">(List<List<List<T>>[]>)x</error>;
|
||||
}
|
||||
|
||||
<T> void foo2(List<String[]> x) {
|
||||
Object y1 = <error descr="Inconvertible types; cannot cast 'java.util.List<java.lang.String[]>' to 'java.util.List<T[]>'">(List<T[]>)x</error>;
|
||||
}
|
||||
}
|
||||
@@ -298,6 +298,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA57325() { doTest5(false); }
|
||||
public void testIDEA67835() { doTest5(false); }
|
||||
public void testIDEA67744() { doTest5(false); }
|
||||
public void testIDEA67682() { doTest5(false); }
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
Reference in New Issue
Block a user