Override/Implement: Drop 'impl' modifier for non-impl class members
#KT-18469 Fixed
This commit is contained in:
+4
@@ -110,6 +110,10 @@ fun OverrideMemberChooserObject.generateMember(targetClass: KtClassOrObject, cop
|
|||||||
else -> error("Unknown member to override: $descriptor")
|
else -> error("Unknown member to override: $descriptor")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!targetClass.hasModifier(KtTokens.IMPL_KEYWORD)) {
|
||||||
|
newMember.removeModifier(KtTokens.IMPL_KEYWORD)
|
||||||
|
}
|
||||||
|
|
||||||
if (copyDoc) {
|
if (copyDoc) {
|
||||||
val superDeclaration = DescriptorToSourceUtilsIde.getAnyDeclaration(project, descriptor)?.navigationElement
|
val superDeclaration = DescriptorToSourceUtilsIde.getAnyDeclaration(project, descriptor)?.navigationElement
|
||||||
val kDoc = when (superDeclaration) {
|
val kDoc = when (superDeclaration) {
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
header abstract class Bar {
|
||||||
|
abstract fun foo()
|
||||||
|
}
|
||||||
idea/testData/multiModuleQuickFix/implementMembersInImplClassNonImplInheritor/header/header.kt.after
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
header abstract class Bar {
|
||||||
|
abstract fun foo()
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
// "Implement members" "true"
|
||||||
|
// DISABLE-ERRORS
|
||||||
|
|
||||||
|
abstract impl class Bar {
|
||||||
|
abstract impl fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
class <caret>X : Bar()
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// "Implement members" "true"
|
||||||
|
// DISABLE-ERRORS
|
||||||
|
|
||||||
|
abstract impl class Bar {
|
||||||
|
abstract impl fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
class X : Bar() {
|
||||||
|
override fun foo() {
|
||||||
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -156,4 +156,7 @@ class QuickFixMultiModuleTest : AbstractQuickFixMultiModuleTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testImplementMembersInHeaderClass() = doMultiPlatformTest(impls = *arrayOf())
|
fun testImplementMembersInHeaderClass() = doMultiPlatformTest(impls = *arrayOf())
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testImplementMembersInImplClassNonImplInheritor() = doMultiPlatformTest()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user