Do not show "Convert to extension" intention for secondary constructors
#KT-6969 Fixed
This commit is contained in:
committed by
Alexey Sedunov
parent
d1308ebf84
commit
4b564fcc51
+1
@@ -71,6 +71,7 @@ public class ConvertMemberToExtension extends BaseIntentionAction {
|
|||||||
if (((JetProperty) declaration).hasInitializer()) return false;
|
if (((JetProperty) declaration).hasInitializer()) return false;
|
||||||
}
|
}
|
||||||
return declaration != null
|
return declaration != null
|
||||||
|
&& !(declaration instanceof JetSecondaryConstructor)
|
||||||
&& declaration.getParent() instanceof JetClassBody
|
&& declaration.getParent() instanceof JetClassBody
|
||||||
&& declaration.getParent().getParent() instanceof JetClass
|
&& declaration.getParent().getParent() instanceof JetClass
|
||||||
&& declaration.getReceiverTypeReference() == null;
|
&& declaration.getReceiverTypeReference() == null;
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// IS_APPLICABLE: false
|
||||||
|
class A {
|
||||||
|
<caret>constructor() {}
|
||||||
|
}
|
||||||
@@ -4014,6 +4014,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("secondaryConstructor.kt")
|
||||||
|
public void testSecondaryConstructor() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/declarations/convertMemberToExtension/secondaryConstructor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/declarations/convertMemberToExtension/simple.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/declarations/convertMemberToExtension/simple.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user