stop at file level when going up the tree in KtPsiUtil.areParenthesesNecessary() (EA-86495 - NPE: KtPsiUtil.areParenthesesNecessary)
This commit is contained in:
@@ -480,7 +480,7 @@ public class KtPsiUtil {
|
|||||||
|
|
||||||
PsiElement current = parentElement;
|
PsiElement current = parentElement;
|
||||||
|
|
||||||
while (!(current instanceof KtBlockExpression || current instanceof KtDeclaration || current instanceof KtStatementExpression)) {
|
while (!(current instanceof KtBlockExpression || current instanceof KtDeclaration || current instanceof KtStatementExpression || current instanceof KtFile)) {
|
||||||
if (current.getTextRange().getEndOffset() != currentInner.getTextRange().getEndOffset()) {
|
if (current.getTextRange().getEndOffset() != currentInner.getTextRange().getEndOffset()) {
|
||||||
return !(current instanceof KtParenthesizedExpression) && !(current instanceof KtValueArgumentList); // if current expression is "guarded" by parenthesis, no extra parenthesis is necessary
|
return !(current instanceof KtParenthesizedExpression) && !(current instanceof KtValueArgumentList); // if current expression is "guarded" by parenthesis, no extra parenthesis is necessary
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user