good code red: leave empty subst when processing type params supers (IDEA-67680)

This commit is contained in:
anna
2012-10-18 21:40:03 +02:00
parent fd9d1764e2
commit a40a08d1d9
3 changed files with 35 additions and 0 deletions
@@ -675,6 +675,9 @@ public class PsiClassImplUtil {
if (superClass == null) continue;
PsiSubstitutor finalSubstitutor = obtainFinalSubstitutor(superClass, superTypeResolveResult.getSubstitutor(), aClass,
state.get(PsiSubstitutor.KEY), factory, languageLevel);
if (aClass instanceof PsiTypeParameter && PsiUtil.isRawSubstitutor(superClass, finalSubstitutor)) {
finalSubstitutor = PsiSubstitutor.EMPTY;
}
if (!processDeclarationsInClass(superClass, processor, state.put(PsiSubstitutor.KEY, finalSubstitutor), visited, last, place, isRaw)) {
resolved = true;
}
@@ -0,0 +1,31 @@
class A<D> {
abstract class C<S> {
<T extends A> void foo(T.C<Integer> x) {
Integer bar = x.bar();
}
<T extends A> void foo1(A.C<error descr="Type arguments given on a raw type"><Integer></error> x) {
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Integer'">Integer bar = x.bar();</error>
}
<T extends A> void foo2(A<String>.C<Integer> x) {
Integer bar = x.bar();
}
abstract S bar();
}
}
class A1 {
abstract class C<S> {
<T extends A1> void foo(T.C<Integer> x) {
Integer bar = x.bar();
}
<T extends A1> void foo1(A1.C<Integer> x) {
Integer bar = x.bar();
}
abstract S bar();
}
}
@@ -151,6 +151,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIncompatibleReturnType() throws Exception { doTest(false); }
public void testContinueInferenceAfterFirstRawResult() throws Exception { doTest(false); }
public void testStaticOverride() throws Exception { doTest(false); }
public void testTypeArgumentsGivenOnRawType() throws Exception { doTest(false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));