IDEA-57403 Completion cannot suggest members of an intersection type

This commit is contained in:
peter
2011-03-03 20:07:58 +01:00
parent d783a84360
commit 893c24c52f
3 changed files with 27 additions and 0 deletions
@@ -117,6 +117,10 @@ public class PsiScopesUtil {
substitutor = substitutor.put(arrayTypeParameters[0], ((PsiArrayType)type).getComponentType());
}
arrayClass.processDeclarations(processor, ResolveState.initial().put(PsiSubstitutor.KEY, substitutor), arrayClass, place);
} else if (type instanceof PsiIntersectionType) {
for (PsiType psiType : ((PsiIntersectionType)type).getConjuncts()) {
processTypeDeclarations(psiType, place, processor);
}
} else {
final JavaResolveResult result = PsiUtil.resolveGenericsClassInType(type);
final PsiClass clazz = (PsiClass)result.getElement();
@@ -0,0 +1,18 @@
interface IA{
void fooa();
}
interface IB{
void foob();
}
interface IC<T extends IA>{
T c();
}
class K {
void foo(IC<? extends IB> x){
x.c().fo<caret>
}
}
@@ -786,6 +786,11 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
checkResultByFile(getTestName(false) + "_after.java")
}
public void testIntersectionTypeMembers() throws Throwable {
configure()
assertStringItems "fooa", "foob"
}
public void testCastInstanceofedQualifier() throws Throwable { doTest(); }
public void testCastComplexInstanceofedQualifier() throws Throwable { doTest(); }