type inference: super bounds promotion corrected (IDEA-55718)

This commit is contained in:
anna
2010-07-19 17:10:52 +04:00
parent 183d248e7d
commit 232cc27726
3 changed files with 20 additions and 0 deletions
@@ -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 {
@@ -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);}