BranchedFoldingUtils: fix psi tree after tryFoldToAssignment
#KT-38677 Fixed
This commit is contained in:
+2
-1
@@ -192,9 +192,10 @@ object BranchedFoldingUtils {
|
|||||||
lhs = left!!.copy() as KtExpression
|
lhs = left!!.copy() as KtExpression
|
||||||
op = operationReference.text
|
op = operationReference.text
|
||||||
}
|
}
|
||||||
|
|
||||||
val rhs = right!!
|
val rhs = right!!
|
||||||
if (rhs is KtLambdaExpression && this.parent !is KtBlockExpression) {
|
if (rhs is KtLambdaExpression && this.parent !is KtBlockExpression) {
|
||||||
replace(psiFactory.createExpressionByPattern("{ $0 }", rhs))
|
replace(psiFactory.createSingleStatementBlock(rhs))
|
||||||
} else {
|
} else {
|
||||||
replace(rhs)
|
replace(rhs)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ fun test(i: Int) {
|
|||||||
|
|
||||||
<caret>fn = if (i == 1) {
|
<caret>fn = if (i == 1) {
|
||||||
{ "foo" }
|
{ "foo" }
|
||||||
} else if (i == 2) {
|
}
|
||||||
|
else if (i == 2) {
|
||||||
{ "bar" }
|
{ "bar" }
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
{ "baz" }
|
{ "baz" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user