Make parentheses necessary for '(x op return y) op z' #KT-16808 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
426a54c3ab
commit
e8b95b971d
@@ -530,11 +530,19 @@ public class KtPsiUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
// '(x operator y)' case
|
||||
if (innerExpression instanceof KtBinaryExpression &&
|
||||
innerOperation != KtTokens.ELVIS &&
|
||||
isKeepBinaryExpressionParenthesized((KtBinaryExpression) innerExpression)) {
|
||||
return true;
|
||||
if (innerExpression instanceof KtBinaryExpression) {
|
||||
// '(x operator return [...]) operator ...' case
|
||||
if (parentElement instanceof KtBinaryExpression) {
|
||||
KtBinaryExpression innerBinary = (KtBinaryExpression) innerExpression;
|
||||
if (innerBinary.getRight() instanceof KtReturnExpression) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// '(x operator y)' case
|
||||
if (innerOperation != KtTokens.ELVIS &&
|
||||
isKeepBinaryExpressionParenthesized((KtBinaryExpression) innerExpression)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int innerPriority = getPriority(innerExpression);
|
||||
|
||||
Reference in New Issue
Block a user