mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
create from usage: don't go through polyadic to deep (IDEA-244730)
GitOrigin-RevId: f7ab010a75203486f0c967ae5ba7c69db81ad812
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2a56ad5b11
commit
4bb02e9e68
@@ -575,10 +575,10 @@ public class CreateFromUsageUtils {
|
||||
if (!(parent instanceof PsiReferenceExpression)) {
|
||||
boolean isAssignmentToFunctionalExpression = PsiUtil.isOnAssignmentLeftHand(expr) &&
|
||||
((PsiAssignmentExpression)PsiUtil.skipParenthesizedExprUp(parent)).getRExpression() instanceof PsiFunctionalExpression;
|
||||
PsiElement gParent = parent.getParent();
|
||||
PsiExpressionList expressionList = ObjectUtils
|
||||
.tryCast(PsiUtil.skipParenthesizedExprUp(isAssignmentToFunctionalExpression ? parent.getParent() : parent),
|
||||
PsiExpressionList.class);
|
||||
boolean forCompletion = expressionList != null || parent.getParent() instanceof PsiPolyadicExpression;
|
||||
.tryCast(PsiUtil.skipParenthesizedExprUp(isAssignmentToFunctionalExpression ? gParent : parent), PsiExpressionList.class);
|
||||
boolean forCompletion = expressionList != null || gParent instanceof PsiPolyadicExpression && !(gParent.getParent() instanceof PsiPolyadicExpression);
|
||||
ExpectedTypeInfo[] someExpectedTypes = ExpectedTypesProvider.getExpectedTypes(expr, forCompletion);
|
||||
if (someExpectedTypes.length > 0) {
|
||||
Comparator<ExpectedTypeInfo> comparator = expectedTypesComparator;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Create method 'test'" "true"
|
||||
public class Test {
|
||||
void test(boolean b, Object obj) {
|
||||
if (b || test() == obj) {
|
||||
// do smth
|
||||
}
|
||||
}
|
||||
|
||||
private Object test() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'test'" "true"
|
||||
public class Test {
|
||||
void test(boolean b, Object obj) {
|
||||
if (b || te<caret>st() == obj) {
|
||||
// do smth
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user