mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
new inference: process wildcards captured bounds
This commit is contained in:
+6
@@ -88,6 +88,9 @@ public class SubtypingConstraint implements ConstraintFormula {
|
||||
}
|
||||
|
||||
if (((PsiWildcardType)myS).isExtends()) {
|
||||
if (sBound instanceof PsiCapturedWildcardType) {
|
||||
return true;
|
||||
}
|
||||
constraints.add(new StrictSubtypingConstraint(tBound, sBound));
|
||||
return true;
|
||||
}
|
||||
@@ -110,6 +113,9 @@ public class SubtypingConstraint implements ConstraintFormula {
|
||||
if (myS instanceof PsiWildcardType) {
|
||||
final PsiType sBound = ((PsiWildcardType)myS).getBound();
|
||||
if (sBound != null && ((PsiWildcardType)myS).isSuper()) {
|
||||
if (sBound instanceof PsiCapturedWildcardType) {
|
||||
return false;
|
||||
}
|
||||
constraints.add(new StrictSubtypingConstraint(sBound, tBound));
|
||||
return true;
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
class B<T1,S> {}
|
||||
abstract class A<T> {
|
||||
|
||||
<K> void baz253(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? super T> foo253();
|
||||
void bar253(A<?> a) {
|
||||
baz253<error descr="'baz253(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<? super capture<?>>>)'">(a.foo253())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz255(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? super T> foo255();
|
||||
void bar255(A<? extends T> a) {
|
||||
baz255<error descr="'baz255(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<? super capture<? extends T>>>)'">(a.foo255())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz256(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? extends T> foo256();
|
||||
void bar256(A<?> a) {
|
||||
baz256<error descr="'baz256(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<?>>)'">(a.foo256())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz258(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? extends T> foo258();
|
||||
void bar258(A<? extends T> a) {
|
||||
baz258<error descr="'baz258(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<? extends T>>)'">(a.foo258())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz259(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ?> foo259();
|
||||
void bar259(A<?> a) {
|
||||
baz259<error descr="'baz259(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<?>>)'">(a.foo259())</error>;
|
||||
}
|
||||
|
||||
<K> void baz261(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ?> foo261();
|
||||
void bar261(A<? extends T> a) {
|
||||
baz261<error descr="'baz261(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<?>>)'">(a.foo261())</error>;
|
||||
}
|
||||
}
|
||||
+4
@@ -776,6 +776,10 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testSuperWildcardCapturedSuperExtendsWildcardCapturedExtends() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user