captured wildcards: check upper bound first

This commit is contained in:
Anna Kozlova
2015-12-01 10:04:46 +01:00
parent a551f22fd8
commit 9308c52a3d
2 changed files with 5 additions and 4 deletions
@@ -749,13 +749,14 @@ public class TypeConversionUtil {
return false;
}
if (left instanceof PsiCapturedWildcardType) {
return left.equals(right) || isAssignable(((PsiCapturedWildcardType)left).getLowerBound(), right, allowUncheckedConversion);
}
if (right instanceof PsiCapturedWildcardType) {
return isAssignable(left, ((PsiCapturedWildcardType)right).getUpperBound(), allowUncheckedConversion);
}
if (left instanceof PsiCapturedWildcardType) {
return left.equals(right) || isAssignable(((PsiCapturedWildcardType)left).getLowerBound(), right, allowUncheckedConversion);
}
if (left instanceof PsiWildcardType) {
return isAssignableToWildcard((PsiWildcardType)left, right);
}
@@ -4,7 +4,7 @@ abstract class A<T> {
<K> void baz37(B<K, ? extends K> a) {}
abstract B<T,? extends T> foo37();
void bar37(A<?> a){
baz37<error descr="'baz37(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<?>,capture<? extends capture<?>>>)'">(a.foo37())</error>;
baz37(a.foo37());
}
<K> void baz39(B<K, ? extends K> a) {}