mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
type inference: super bounds promotion corrected (IDEA-55718)
This commit is contained in:
@@ -185,6 +185,9 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
if (wildcardToCapture != null) {
|
||||
if (lowerBound != PsiType.NULL) {
|
||||
if (!wildcardToCapture.isAssignableFrom(lowerBound)) return getFailedInferenceConstraint(typeParameter);
|
||||
if (wildcardToCapture.isSuper()) {
|
||||
return new Pair<PsiType, ConstraintType>(wildcardToCapture, ConstraintType.SUPERTYPE);
|
||||
}
|
||||
lowerBound = GenericsUtil.getLeastUpperBound(lowerBound, wildcardToCapture, typeParameter.getManager());
|
||||
}
|
||||
else {
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
public class ExampleProblem {
|
||||
<T> void asserting(T t, Simple<T> l){
|
||||
}
|
||||
|
||||
<K> Simple<? super K> comp(K k){
|
||||
return null;
|
||||
}
|
||||
|
||||
public void main(String[] args) {
|
||||
asserting(0, comp(0));
|
||||
}
|
||||
}
|
||||
|
||||
class Simple<SST>{
|
||||
|
||||
}
|
||||
@@ -49,6 +49,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testExplicitMethodParameters() throws Exception { doTest(false); }
|
||||
public void testExplicitMethodParameters1() throws Exception { doTest(false); }
|
||||
public void testInferenceWithBounds() throws Exception {doTest(false);}
|
||||
public void testInferenceWithSuperBounds() throws Exception {doTest(false);}
|
||||
public void testVariance() throws Exception {doTest(false);}
|
||||
public void testForeachTypes() throws Exception {doTest(false);}
|
||||
public void testRawOverridingMethods() throws Exception {doTest(false);}
|
||||
|
||||
Reference in New Issue
Block a user