Move: Fix scope of internal reference recovery in the case of file move
#KT-22282 Fixed
This commit is contained in:
+6
-1
@@ -293,7 +293,12 @@ class MoveKotlinDeclarationsProcessor(
|
||||
}
|
||||
}
|
||||
|
||||
newDeclarations.forEach { newInternalUsages += restoreInternalUsages(it, oldToNewElementsMapping) }
|
||||
val internalUsageScopes: List<KtElement> = if (descriptor.scanEntireFile) {
|
||||
newDeclarations.map { it.containingKtFile }.distinct()
|
||||
} else {
|
||||
newDeclarations
|
||||
}
|
||||
internalUsageScopes.forEach { newInternalUsages += restoreInternalUsages(it, oldToNewElementsMapping) }
|
||||
|
||||
usagesToProcess += newInternalUsages
|
||||
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package my2
|
||||
|
||||
import my2.Foo.*
|
||||
|
||||
class Foo {
|
||||
class Bar
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val b = Bar()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package my
|
||||
|
||||
import my.Foo.*
|
||||
|
||||
class Foo {
|
||||
class Bar
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val b = Bar()
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"mainFile": "my/test.kt",
|
||||
"type": "MOVE_FILES",
|
||||
"targetPackage": "my2"
|
||||
}
|
||||
@@ -307,6 +307,12 @@ public class MoveTestGenerated extends AbstractMoveTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlin/moveFile/selfReferenceInImport/selfReferenceInImport.test")
|
||||
public void testKotlin_moveFile_selfReferenceInImport_SelfReferenceInImport() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveFile/selfReferenceInImport/selfReferenceInImport.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlin/moveFile/typeRefWithArguments/typeRefWithArguments.test")
|
||||
public void testKotlin_moveFile_typeRefWithArguments_TypeRefWithArguments() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveFile/typeRefWithArguments/typeRefWithArguments.test");
|
||||
|
||||
Reference in New Issue
Block a user