More accurate handling of Elvis in areParenthesesNecessary #KT-15227 Fixed
This commit is contained in:
@@ -503,7 +503,10 @@ public class KtPsiUtil {
|
||||
if (parentElement instanceof KtLabeledExpression) return false;
|
||||
|
||||
// 'x ?: ...' case
|
||||
if (parentElement instanceof KtBinaryExpression && parentOperation == KtTokens.ELVIS && currentInner == ((KtBinaryExpression) parentElement).getRight()) {
|
||||
if (parentElement instanceof KtBinaryExpression &&
|
||||
parentOperation == KtTokens.ELVIS &&
|
||||
!(innerExpression instanceof KtBinaryExpression) &&
|
||||
currentInner == ((KtBinaryExpression) parentElement).getRight()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user