diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt index d0874d11c1e..f551b851c8e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt @@ -172,7 +172,7 @@ class MoveKotlinDeclarationsHandler : MoveHandlerDelegate() { return elements.all { e -> when { - e is KtClass || e is KtObjectDeclaration && !e.isObjectLiteral() || e is KtNamedFunction || e is KtProperty -> + e is KtClass || e is KtObjectDeclaration && !e.isObjectLiteral() || e is KtNamedFunction || e is KtProperty || e is KtTypeAlias -> (editorMode || (e as KtNamedDeclaration).canMove()) && e.canRefactor() e is KtFile -> e.declarations.any { it is KtNamedDeclaration } && e.canRefactor() diff --git a/idea/testData/refactoring/moveHandler/declarations/typeAlias/test.kt b/idea/testData/refactoring/moveHandler/declarations/typeAlias/test.kt new file mode 100644 index 00000000000..adcc2f03ac6 --- /dev/null +++ b/idea/testData/refactoring/moveHandler/declarations/typeAlias/test.kt @@ -0,0 +1,3 @@ +class A + +typealias B = A \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt index 243a4e30ee9..fe2ab245670 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt @@ -198,4 +198,9 @@ class MoveKotlinDeclarationsHandlerTest : KotlinMultiFileTestCase() { assert(nestedTarget.name == "C") assert(handler.canMove(elementsToMove, nestedTarget)) } + + fun testTypeAlias() = doTest { rootDir, handler -> + val typeAlias = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! + assert(handler.canMove(arrayOf(typeAlias), null)) + } } \ No newline at end of file