diff --git a/ChangeLog.md b/ChangeLog.md index 68b61d6fa30..becff93f1c0 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -110,6 +110,7 @@ These artifacts include extensions for the types available in the latter JDKs, s #### Intention actions, inspections and quickfixes - [`KT-9490`](https://youtrack.jetbrains.com/issue/KT-9490) Convert receiver to parameter: use template instead of the dialog +- [`KT-11483`](https://youtrack.jetbrains.com/issue/KT-11483) Move to Companion: Do not use qualified names as labels ##### New features diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt index a2e617a8325..6c1a616c1ca 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt @@ -135,7 +135,7 @@ class MoveMemberToCompanionObjectIntention : SelfTargetingRangeIntentionf() { + println(v1) + } + fun use() { f() } +} \ No newline at end of file diff --git a/idea/testData/intentions/moveToCompanion/doNotQualifyThisLabel.kt.after b/idea/testData/intentions/moveToCompanion/doNotQualifyThisLabel.kt.after new file mode 100644 index 00000000000..04165ea83cb --- /dev/null +++ b/idea/testData/intentions/moveToCompanion/doNotQualifyThisLabel.kt.after @@ -0,0 +1,15 @@ +// WITH_RUNTIME +package foo + +class InsertThis { + val v1 = 1 + fun use() { + Companion.f(this) + } + + companion object { + fun f(insertThis: InsertThis) { + println(insertThis.v1) + } + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index 7d749381601..031ab8fd7a2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -9001,6 +9001,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/moveToCompanion"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); } + @TestMetadata("doNotQualifyThisLabel.kt") + public void testDoNotQualifyThisLabel() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveToCompanion/doNotQualifyThisLabel.kt"); + doTest(fileName); + } + @TestMetadata("dropFinal.kt") public void testDropFinal() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveToCompanion/dropFinal.kt");