[FIR] Only add non-subsumed to overridden of intersection override

If an intersection override overrides members A.x, B.x and C.x and
B <: A, then A.x is subsumed by B.x, and we don't add it to the list of
overridden members. This fixes a false-positive MANY_IMPL_MEMBER_NOT_
IMPLEMENTED where an implementation is subsumed by an abstract override.

^KT-57092 Fixed
This commit is contained in:
Kirill Rakhman
2023-03-06 16:00:23 +01:00
committed by Space Team
parent 6afb1b7363
commit 83845fbab5
9 changed files with 64 additions and 36 deletions
@@ -1,16 +0,0 @@
interface A {
fun foo() {}
}
interface B : A {
abstract override fun foo()
}
interface C : A {
abstract override fun foo()
}
interface D : A
// Fake override Z#foo should be abstract
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class Z<!> : B, C, D
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface A {
fun foo() {}
}
@@ -0,0 +1,21 @@
// SKIP_TXT
// FIR_IDENTICAL
// ISSUE: KT-57092
interface InterfaceWithDefault {
val hostKind: Int get() = 24
}
interface SubInterfaceWithoutDefault : InterfaceWithDefault {
// SubInterfaceWithoutDefault.hostKind subsumes InterfaceWithDefault.hostKind, therefore no error.
override val hostKind: Int
}
open class ClassWithDefault : InterfaceWithDefault {
override val hostKind: Int get() = 42
}
class InheritsAll :
ClassWithDefault(),
SubInterfaceWithoutDefault,
InterfaceWithDefault