KT-6632 "Convert to extension" intention should not be available on methods that override or implement a superclass method
#KT-6632 Fixed
This commit is contained in:
@@ -36,6 +36,7 @@ public class ConvertMemberToExtension : JetSelfTargetingRangeIntention<JetCallab
|
||||
val classBody = element.getParent() as? JetClassBody ?: return null
|
||||
if (classBody.getParent() !is JetClass) return null
|
||||
if (element.getReceiverTypeReference() != null) return null
|
||||
if (element.hasModifier(JetTokens.OVERRIDE_KEYWORD)) return null
|
||||
when (element) {
|
||||
is JetProperty -> if (element.hasInitializer()) return null
|
||||
is JetSecondaryConstructor -> return null
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: false
|
||||
trait I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
class C : I {
|
||||
override fun <caret>foo() {
|
||||
}
|
||||
}
|
||||
@@ -3921,6 +3921,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("override.kt")
|
||||
public void testOverride() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/declarations/convertMemberToExtension/override.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("private.kt")
|
||||
public void testPrivate() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/declarations/convertMemberToExtension/private.kt");
|
||||
|
||||
Reference in New Issue
Block a user