generics: choose least bound symmetric (IDEA-57500)

This commit is contained in:
anna
2013-04-30 18:12:19 +02:00
parent 504c2c3867
commit 4e3928010b
3 changed files with 19 additions and 1 deletions
@@ -150,7 +150,7 @@ public class GenericsUtil {
if (type2 instanceof PsiWildcardType) {
PsiWildcardType wild2 = (PsiWildcardType)type2;
final PsiType bound2 = wild2.getBound();
if (bound2 == null) return wild1;
if (bound2 == null) return type2;
if (wild1.isExtends() == wild2.isExtends()) {
return wild1.isExtends() ?
PsiWildcardType.createExtends(manager, getLeastUpperBound(bound1, bound2, compared, manager)) :
@@ -0,0 +1,14 @@
package pck;
interface I<T> {}
interface A extends I<I<? extends String>>{}
interface B extends I<I<?>>{}
abstract class X {
abstract <T> T foo(T x, T y);
void bar(A x, B y){
foo(x, y);
foo(y, y);
}
}
@@ -192,6 +192,10 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase {
doTestAmbiguous();
}
public void testAmbiguousIDEA57500() throws Exception {
doTestAmbiguous();
}
public void testAmbiguousMethodsFromSameClassAccess() throws Exception {
doTestAmbiguous();
}