Files
kotlin-fork/compiler/testData/diagnostics/tests/j+k/collectionOverrides/intersectionWithMappedSignature.fir.kt
T
Kirill Rakhman 26fae9e83a [FIR] Allow declarations to override parts of non-trivial intersection
A class can inherit two declarations that are compatible from the
overridability standpoint and are therefore combined to a non-trivial
intersection.
At the same time, the class can declare a member declaration that
only overrides one of the intersection's members.
In this case, we break up the intersection and only add the overridden
parts to the declared member's direct overridden list.

If the class doesn't override the intersection, it exists as
intersection override, like before.

#KT-65487 Fixed
2024-02-20 09:02:39 +00:00

38 lines
847 B
Kotlin
Vendored

// FULL_JDK
// SCOPE_DUMP: B1:remove, B2:remove
// FILE: Java1.java
public interface Java1 {
Boolean remove(Integer element);
}
// FILE: testRemove.kt
import java.util.*
// CONFLICTING_JVM_DECLARATIONS in K1 is only reported with old backend, not with K1.
class B1 : ArrayList<Int>(), Java1 {
override fun remove(element: Int?): Boolean {
return false
}
}
// CONFLICTING_JVM_DECLARATIONS in K1 is only reported with old backend, not with K1.
class B2 : ArrayList<Int>(), Java1 {
}
// FILE: Java2.java
public interface Java2 {
Character get(Integer i);
}
// FILE: MyString.java
public abstract class MyString implements CharSequence {
@Override
public char charAt(int i) {
return 'c';
}
}
// FILE: testRenamed.kt
abstract class B3 : MyString(), Java2 {
override fun get(i: Int?): Char? = null
}