Move/Change Package Directive Intention: Skip callee references to inner class constructors
#KT-10554 Fixed
This commit is contained in:
@@ -132,6 +132,7 @@ fun KtElement.lazilyProcessInternalReferencesToUpdateOnPackageNameChange(
|
||||
fun doCreateUsageInfo(refExpr: KtSimpleNameExpression): UsageInfo? {
|
||||
if (isAncestor(declaration, false)) {
|
||||
if (descriptor.importableFqName == null) return null
|
||||
if (descriptor is ClassDescriptor && descriptor.isInner && refExpr.parent is KtCallExpression) return null
|
||||
if (isUnqualifiedExtensionReference(refExpr.mainReference, declaration)) return null
|
||||
if (packageName == null || !newPackageName.isSafe) return null
|
||||
return fqName.asString().let {
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package baz
|
||||
|
||||
import foo.Class1
|
||||
|
||||
class Class2 : Class1() {
|
||||
init { InnerClass() }
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
package foo
|
||||
|
||||
open class Class1() {
|
||||
init { InnerClass() }
|
||||
open inner class InnerClass() { }
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package baz
|
||||
|
||||
import bar.Class1
|
||||
|
||||
class Class2 : Class1() {
|
||||
init { InnerClass() }
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
pack<caret>age bar
|
||||
|
||||
open class Class1() {
|
||||
init { InnerClass() }
|
||||
open inner class InnerClass() { }
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"intentionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageToMatchDirectoryIntention",
|
||||
"isApplicable": "true",
|
||||
"mainFile": "foo/test.kt"
|
||||
}
|
||||
@@ -107,6 +107,12 @@ public class MultiFileIntentionTestGenerated extends AbstractMultiFileIntentionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reconcilePackageWithDirectory/innerClass/innerClass.test")
|
||||
public void testReconcilePackageWithDirectory_innerClass_InnerClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/innerClass/innerClass.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test")
|
||||
public void testReconcilePackageWithDirectory_packageMatchesDirectory_PackageMatchesDirectory() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiFileIntentions/reconcilePackageWithDirectory/packageMatchesDirectory/packageMatchesDirectory.test");
|
||||
|
||||
Reference in New Issue
Block a user