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
|
||||
op = operationReference.text
|
||||
}
|
||||
|
||||
val rhs = right!!
|
||||
if (rhs is KtLambdaExpression && this.parent !is KtBlockExpression) {
|
||||
replace(psiFactory.createExpressionByPattern("{ $0 }", rhs))
|
||||
replace(psiFactory.createSingleStatementBlock(rhs))
|
||||
} else {
|
||||
replace(rhs)
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ fun test(i: Int) {
|
||||
|
||||
<caret>fn = if (i == 1) {
|
||||
{ "foo" }
|
||||
} else if (i == 2) {
|
||||
}
|
||||
else if (i == 2) {
|
||||
{ "bar" }
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
{ "baz" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user