mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
nested conditional expressions: don't require nested to be poly if outer is not
This commit is contained in:
@@ -128,7 +128,7 @@ public class PsiPolyExpressionUtil {
|
||||
final PsiElement context = PsiUtil.skipParenthesizedExprUp(expr.getParent());
|
||||
return context instanceof PsiExpressionList ||
|
||||
context instanceof PsiArrayInitializerExpression ||
|
||||
context instanceof PsiConditionalExpression ||
|
||||
context instanceof PsiConditionalExpression && isPolyExpression((PsiExpression)context) ||
|
||||
isAssignmentContext(expr, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class C {
|
||||
public static void main(Object o) {
|
||||
List l = (List)(o instanceof ArrayList ? (ArrayList)o : o instanceof List ? (List)o : o);
|
||||
}
|
||||
}
|
||||
@@ -279,6 +279,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNestedConditionalExpressions() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user