From b0a99c7945fd006fe01f96f13bf2627fbfeb5a84 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Wed, 21 Mar 2018 16:01:49 +0300 Subject: [PATCH] Move Out Of Object Intention: Fix assertion error #KT-22983 Fixed --- .../MoveMemberOutOfObjectIntention.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberOutOfObjectIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberOutOfObjectIntention.kt index a76d2a7b28b..0ba476a4836 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberOutOfObjectIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberOutOfObjectIntention.kt @@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement import com.intellij.util.containers.MultiMap import org.jetbrains.kotlin.idea.refactoring.checkConflictsInteractively import org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.* +import org.jetbrains.kotlin.idea.refactoring.runRefactoringWithPostprocessing import org.jetbrains.kotlin.idea.util.application.runWriteAction import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtElement @@ -47,13 +48,17 @@ abstract class MoveMemberOutOfObjectIntention(text: String) : SelfTargetingRange } if (element is KtClassOrObject) { - val moveDescriptor = MoveDeclarationsDescriptor(project, - listOf(element), - KotlinMoveTargetForExistingElement(destination), - MoveDeclarationsDelegate.NestedClass()) - runWriteAction { - MoveKotlinDeclarationsProcessor(moveDescriptor).run() - deleteClassOrObjectIfEmpty() + val moveDescriptor = MoveDeclarationsDescriptor( + project, + listOf(element), + KotlinMoveTargetForExistingElement(destination), + MoveDeclarationsDelegate.NestedClass() + ) + val refactoring = { MoveKotlinDeclarationsProcessor(moveDescriptor).run() } + refactoring.runRefactoringWithPostprocessing(project, MoveKotlinDeclarationsProcessor.REFACTORING_ID) { + runWriteAction { + deleteClassOrObjectIfEmpty() + } } return }