generics: do not accept inferred lower bound when inferred through raw type (IDEA-93672)

This commit is contained in:
anna
2012-10-26 13:29:55 +02:00
parent 8dcd6ba5d3
commit 8f303c23aa
3 changed files with 19 additions and 1 deletions
@@ -273,8 +273,8 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
}
}
if (lowerBound != PsiType.NULL) return new Pair<PsiType, ConstraintType>(lowerBound, ConstraintType.EQUALS);
if (rawInference != null) return rawInference;
if (lowerBound != PsiType.NULL) return new Pair<PsiType, ConstraintType>(lowerBound, ConstraintType.EQUALS);
if (parent != null) {
final Pair<PsiType, ConstraintType> constraint =
@@ -0,0 +1,17 @@
import java.util.*;
class Test {
interface Condition<K> {}
class IOC<M> implements Condition {}
static <T> List<T> filter(T[] c, Condition<? super T> con) {
return null;
}
interface OE {}
interface LOE extends OE {}
void foo(OE[] es, IOC<LOE> con) {
List<LOE> l = filter(es, con);
}
}
@@ -183,6 +183,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testInconvertibleTypes() throws Exception { doTest(false); }
public void testIncompatibleReturnType() throws Exception { doTest(false); }
public void testContinueInferenceAfterFirstRawResult() throws Exception { doTest(false); }
public void testDoNotAcceptLowerBoundIfRaw() throws Exception { doTest(false); }
public void testStaticOverride() throws Exception { doTest(false); }
public void testTypeArgumentsGivenOnRawType() throws Exception { doTest(false); }
public void testTypeArgumentsGivenOnAnonymousClassCreation() throws Exception { doTest(false); }