mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-230899 Wrong lambda-completion type inference
GitOrigin-RevId: 185f1a9f35895a5c891ac0586e4c46959f98f342
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3bfc8864c2
commit
021d6b9444
@@ -516,14 +516,7 @@ public class GenerateMembersUtil {
|
||||
if (PsiUtil.isRawSubstitutor(owner, substitutor)) {
|
||||
return TypeConversionUtil.erasure(type);
|
||||
}
|
||||
final PsiType psiType = substitutor.substitute(type);
|
||||
if (psiType != null) {
|
||||
final PsiType deepComponentType = psiType.getDeepComponentType();
|
||||
if (!(deepComponentType instanceof PsiCapturedWildcardType || deepComponentType instanceof PsiWildcardType)){
|
||||
return psiType;
|
||||
}
|
||||
}
|
||||
return TypeConversionUtil.erasure(type);
|
||||
return GenericsUtil.eliminateWildcards(substitutor.substitute(type), false, true);
|
||||
}
|
||||
|
||||
public static boolean isChildInRange(PsiElement child, PsiElement first, PsiElement last) {
|
||||
|
||||
@@ -460,11 +460,13 @@ public class GenericsUtil {
|
||||
|
||||
PsiElementFactory factory = JavaPsiFacade.getElementFactory(manager.getProject());
|
||||
PsiSubstitutor substitutor = factory.createSubstitutor(map);
|
||||
type = factory.createType(aClass, substitutor);
|
||||
type = factory.createType(aClass, substitutor).annotate(classType.getAnnotationProvider());
|
||||
}
|
||||
}
|
||||
else if (type instanceof PsiArrayType) {
|
||||
return eliminateWildcards(((PsiArrayType)type).getComponentType(), false).createArrayType();
|
||||
PsiType component = eliminateWildcards(((PsiArrayType)type).getComponentType(), false);
|
||||
PsiType newArray = type instanceof PsiEllipsisType ? new PsiEllipsisType(component) : new PsiArrayType(component);
|
||||
return newArray.annotate(type.getAnnotationProvider());
|
||||
}
|
||||
else if (type instanceof PsiWildcardType) {
|
||||
final PsiType bound = ((PsiWildcardType)type).getBound();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test88 {
|
||||
void foo(java.util.Collection<? extends String> foo) {
|
||||
foo.forEach(s -> <caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test88 {
|
||||
void foo(java.util.Collection<? extends String> foo) {
|
||||
foo.forEach(s<caret>);
|
||||
}
|
||||
}
|
||||
+2
@@ -83,6 +83,8 @@ public class SmartType18CompletionTest extends LightFixtureCompletionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInCollectionForEach() { doTest();}
|
||||
|
||||
public void testConstructorRef() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user