diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/moveConflictUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/moveConflictUtils.kt index 7c31ef66d0d..ade7a7d30c8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/moveConflictUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/moveConflictUtils.kt @@ -34,6 +34,7 @@ import com.intellij.refactoring.util.MoveRenameUsageInfo import com.intellij.refactoring.util.NonCodeUsageInfo import com.intellij.refactoring.util.RefactoringUIUtil import com.intellij.usageView.UsageInfo +import com.intellij.usageView.UsageViewTypeLocation import com.intellij.util.containers.MultiMap import org.jetbrains.kotlin.asJava.namedUnwrappedElement import org.jetbrains.kotlin.asJava.toLightMethods @@ -491,7 +492,14 @@ class MoveConflictChecker( if (isToBeMoved(rootClass) && subclasses.all { isToBeMoved(it) }) continue - conflicts.putValue(rootClass, "Sealed class '${rootClass.name}' must be moved with all its subclasses") + val message = if (elementToMove == rootClass) { + "Sealed class '${rootClass.name}' must be moved with all its subclasses" + } + else { + val type = ElementDescriptionUtil.getElementDescription(elementToMove, UsageViewTypeLocation.INSTANCE).capitalize() + "$type '${rootClass.name}' must be moved with sealed parent class and all its subclasses" + } + conflicts.putValue(elementToMove, message) } } diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/sealedSubclassWithSkippedRoot/conflicts.txt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/sealedSubclassWithSkippedRoot/conflicts.txt index 756eb0a8202..08ad262dd99 100644 --- a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/sealedSubclassWithSkippedRoot/conflicts.txt +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/sealedSubclassWithSkippedRoot/conflicts.txt @@ -1 +1 @@ -Sealed class 'Expr' must be moved with all its subclasses +Class 'Expr' must be moved with sealed parent class and all its subclasses