diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/move/moveUtils.kt b/idea/src/org/jetbrains/jet/plugin/refactoring/move/moveUtils.kt index c65adb8e0f8..8d98f7b2f96 100644 --- a/idea/src/org/jetbrains/jet/plugin/refactoring/move/moveUtils.kt +++ b/idea/src/org/jetbrains/jet/plugin/refactoring/move/moveUtils.kt @@ -88,7 +88,7 @@ public fun JetElement.getInternalReferencesToUpdateOnPackageNameChange(packageNa if (descriptor == null || !descriptor.canBeReferencedViaImport()) continue val declaration = DescriptorToDeclarationUtil.getDeclaration(file, descriptor) - if (declaration == null || isAncestor(declaration, true)) continue + if (declaration == null || isAncestor(declaration, false)) continue val fqName = DescriptorUtils.getFqName(descriptor) if (!fqName.isSafe()) continue diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/after/source/A.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/after/source/A.kt new file mode 100644 index 00000000000..253d8e303f8 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/after/source/A.kt @@ -0,0 +1,5 @@ +package source + +class B { + +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/after/target/A.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/after/target/A.kt new file mode 100644 index 00000000000..eafb862a035 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/after/target/A.kt @@ -0,0 +1,5 @@ +package target + +class A(val a: A) { + val klass = javaClass() +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/before/source/A.kt b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/before/source/A.kt new file mode 100644 index 00000000000..018d94a1a54 --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/before/source/A.kt @@ -0,0 +1,9 @@ +package source + +class A(val a: A) { + val klass = javaClass() +} + +class B { + +} \ No newline at end of file diff --git a/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/selfReferences.test b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/selfReferences.test new file mode 100644 index 00000000000..69190fd7e7f --- /dev/null +++ b/idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/selfReferences.test @@ -0,0 +1,5 @@ +{ + "mainFile": "source/A.kt", + "type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS", + "targetPackage": "target" +} diff --git a/idea/tests/org/jetbrains/jet/plugin/refactoring/move/JetMoveTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/refactoring/move/JetMoveTestGenerated.java index d5ea1069d98..0f6de7d6dd4 100644 --- a/idea/tests/org/jetbrains/jet/plugin/refactoring/move/JetMoveTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/refactoring/move/JetMoveTestGenerated.java @@ -258,6 +258,12 @@ public class JetMoveTestGenerated extends AbstractJetMoveTest { doTest(fileName); } + @TestMetadata("kotlin/moveTopLevelDeclarations/misc/selfReferences/selfReferences.test") + public void testKotlin_moveTopLevelDeclarations_misc_selfReferences_SelfReferences() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/misc/selfReferences/selfReferences.test"); + doTest(fileName); + } + @TestMetadata("kotlin/moveTopLevelDeclarations/moveClassToFile/moveClassToFile.test") public void testKotlin_moveTopLevelDeclarations_moveClassToFile_MoveClassToFile() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveTopLevelDeclarations/moveClassToFile/moveClassToFile.test");