Suggest "Remove braces" in nested if correctly #KT-14270 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
8082a5daf7
commit
e328d2d1ca
@@ -38,7 +38,10 @@ class RemoveBracesIntention : SelfTargetingIntention<KtElement>(KtElement::class
|
||||
val container = block.parent
|
||||
when (container) {
|
||||
is KtContainerNode -> {
|
||||
if (singleStatement is KtIfExpression && container.parent is KtIfExpression) return false
|
||||
if (singleStatement is KtIfExpression) {
|
||||
val elseExpression = (container.parent as? KtIfExpression)?.`else`
|
||||
if (elseExpression != null && elseExpression != block) return false
|
||||
}
|
||||
|
||||
val description = container.description() ?: return false
|
||||
text = "Remove braces from '$description' statement"
|
||||
|
||||
Reference in New Issue
Block a user