Implement members: fix it works correctly for data class
#KT-36686 Fixed
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
fe009ac695
commit
62e335ac88
+3
-3
@@ -146,9 +146,9 @@ abstract class OverrideImplementMembersHandler : LanguageCodeInsightActionHandle
|
||||
|
||||
fun ClassDescriptor.findElement(memberDescriptor: CallableMemberDescriptor): KtDeclaration? {
|
||||
return implementedElements[memberDescriptor]
|
||||
?: (findCallableMemberBySignature(memberDescriptor)?.source?.getPsi() as? KtDeclaration)?.also {
|
||||
implementedElements[memberDescriptor] = it
|
||||
}
|
||||
?: (findCallableMemberBySignature(memberDescriptor)?.source?.getPsi() as? KtDeclaration)
|
||||
?.takeIf { it != classOrObject }
|
||||
?.also { implementedElements[memberDescriptor] = it }
|
||||
}
|
||||
|
||||
fun getAnchor(selectedElement: KtDeclaration): PsiElement? {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Implement members" "true"
|
||||
// WITH_RUNTIME
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
data <caret>class C(val i: Int) : I
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Implement members" "true"
|
||||
// WITH_RUNTIME
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
data class C(val i: Int) : I {
|
||||
override fun foo() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Implement members" "true"
|
||||
// WITH_RUNTIME
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
data <caret>class C(val i: Int) : I {}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Implement members" "true"
|
||||
// WITH_RUNTIME
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
data class C(val i: Int) : I {
|
||||
override fun foo() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Implement members" "true"
|
||||
// WITH_RUNTIME
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
data <caret>class C(val i: Int) : I {
|
||||
fun bar() {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Implement members" "true"
|
||||
// WITH_RUNTIME
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
data class C(val i: Int) : I {
|
||||
fun bar() {}
|
||||
override fun foo() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -7669,6 +7669,21 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
runTest("idea/testData/quickfix/implement/annotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dataClass.kt")
|
||||
public void testDataClass() throws Exception {
|
||||
runTest("idea/testData/quickfix/implement/dataClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dataClass2.kt")
|
||||
public void testDataClass2() throws Exception {
|
||||
runTest("idea/testData/quickfix/implement/dataClass2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dataClass3.kt")
|
||||
public void testDataClass3() throws Exception {
|
||||
runTest("idea/testData/quickfix/implement/dataClass3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("doNotAddExpectForVal.kt")
|
||||
public void testDoNotAddExpectForVal() throws Exception {
|
||||
runTest("idea/testData/quickfix/implement/doNotAddExpectForVal.kt");
|
||||
|
||||
Reference in New Issue
Block a user