intersection rules: flatten unbounded wildcard with everything (IDEA-132431)

This commit is contained in:
Anna Kozlova
2014-11-07 15:47:50 +01:00
parent 6aef1682d6
commit 96bfd65ab3
3 changed files with 24 additions and 2 deletions
@@ -78,8 +78,8 @@ public class PsiIntersectionType extends PsiType.Stub {
for (PsiType existing : array) {
if (type != existing) {
final boolean allowUncheckedConversion = type instanceof PsiClassType && ((PsiClassType)type).isRaw();
if (TypeConversionUtil.isAssignable(GenericsUtil.eliminateWildcards(type),
GenericsUtil.eliminateWildcards(existing), allowUncheckedConversion)) {
if (TypeConversionUtil.isAssignable(type, existing, allowUncheckedConversion) ||
TypeConversionUtil.isAssignable(GenericsUtil.eliminateWildcards(type), GenericsUtil.eliminateWildcards(existing), allowUncheckedConversion)) {
iterator.remove();
break;
}
@@ -0,0 +1,18 @@
interface A<T> {
void method();
}
interface B<T extends A<?>> {
void method(T arg);
}
interface C {
void method(B<? extends A<String>> arg);
}
class Test {
public static void test(C c) {
c.method(arg -> arg.method( ));
}
}
@@ -40,6 +40,10 @@ public class FunctionalTypeWildcardParameterizationTest extends LightDaemonAnaly
doTest();
}
public void testNonWildcardParameterizationForNonBoundWildcardBound() throws Exception {
doTest();
}
private void doTest() {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);