Move: Do not process imported references when moving entire file
#KT-17538 Fixed
This commit is contained in:
@@ -163,7 +163,10 @@ fun KtElement.processInternalReferencesToUpdateOnPackageNameChange(
|
|||||||
}
|
}
|
||||||
.firstOrNull()
|
.firstOrNull()
|
||||||
|
|
||||||
if (isExtension || containerFqName != null || isImported(descriptor)) return {
|
val isImported = isImported(descriptor)
|
||||||
|
if (isImported && this is KtFile) return null
|
||||||
|
|
||||||
|
if (isExtension || containerFqName != null || isImported) return {
|
||||||
createMoveUsageInfoIfPossible(it.mainReference, declaration, false, true)
|
createMoveUsageInfoIfPossible(it.mainReference, declaration, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,6 +16,6 @@ public fun test(a: A) {
|
|||||||
a.bar()
|
a.bar()
|
||||||
a.foo()
|
a.foo()
|
||||||
B().foo().bar()
|
B().foo().bar()
|
||||||
B().foo().bar()
|
library.B().foo().bar()
|
||||||
B().bar().foo()
|
B().bar().foo()
|
||||||
}
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package one
|
||||||
|
|
||||||
|
class ImportedWithAlias
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package three
|
||||||
|
|
||||||
|
import one.ImportedWithAlias as WithAlias
|
||||||
|
|
||||||
|
val v1 = WithAlias()
|
||||||
|
val v2 = 2
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package one
|
||||||
|
|
||||||
|
class ImportedWithAlias
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package two
|
||||||
|
|
||||||
|
import one.ImportedWithAlias as WithAlias
|
||||||
|
|
||||||
|
val v1 = WithAlias()
|
||||||
|
val v2 = 2
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "two/Source.kt",
|
||||||
|
"type": "MOVE_FILES",
|
||||||
|
"targetPackage": "three"
|
||||||
|
}
|
||||||
@@ -258,6 +258,12 @@ public class MoveTestGenerated extends AbstractMoveTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlin/moveFile/keepImportAliasRefs/keepImportAliasRefs.test")
|
||||||
|
public void testKotlin_moveFile_keepImportAliasRefs_KeepImportAliasRefs() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveFile/keepImportAliasRefs/keepImportAliasRefs.test");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test")
|
@TestMetadata("kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test")
|
||||||
public void testKotlin_moveFile_moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir_MoveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir() throws Exception {
|
public void testKotlin_moveFile_moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir_MoveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveFile/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir/moveFileAndDirWithJavaFileReferringToPackageFragementWithUnmatchedDir.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user