Fix bug in assignment-to-when unfolding

This commit is contained in:
Alexey Sedunov
2013-04-16 15:18:32 +04:00
parent 09b4a5afa3
commit 2ba806bee8
@@ -79,7 +79,7 @@ public class BranchedUnfoldingUtils {
public static void unfoldAssignmentToWhen(@NotNull JetBinaryExpression assignment) {
Project project = assignment.getProject();
String op = assignment.getOperationReference().getText();
JetExpression lhs = (JetExpression)assignment.getLeft().copy();
String lhsText = assignment.getLeft().getText();
JetWhenExpression whenExpression = (JetWhenExpression)assignment.getRight();
assert whenExpression != null : UNFOLD_WITHOUT_CHECK;
@@ -91,7 +91,7 @@ public class BranchedUnfoldingUtils {
assert currExpr != null : UNFOLD_WITHOUT_CHECK;
currExpr.replace(JetPsiFactory.createBinaryExpression(project, lhs, op, currExpr));
currExpr.replace(JetPsiFactory.createBinaryExpression(project, JetPsiFactory.createExpression(project, lhsText), op, currExpr));
}
}