[FIR] Relax intersection overrides visibility requirements for Java

Allow multiple bases with default
implementations as long as there's a
non-abstract symbol from a class.

Our rules for Kotlin are stricter than
those in Java.
This commit is contained in:
Nikolay Lunyak
2024-02-20 14:48:49 +02:00
committed by Space Team
parent 76ed5453b3
commit da6006b7d0
17 changed files with 159 additions and 100 deletions
@@ -1,34 +0,0 @@
// TARGET_BACKEND: JVM
// FILE: IntCollection.java
interface IntCollection<E> {
public boolean add(int key);
}
// FILE: IntSet.java
interface IntSet extends IntCollection {
public default boolean add(Integer it) { return true; }
// from the supertype
// public boolean add(int key);
}
// FILE: AbstractCollection.java
abstract class AbstractCollection<E> {
public boolean add(E it) { return true; }
}
// FILE: AbstractIntCollection.java
abstract class AbstractIntCollection extends AbstractCollection<Integer> {
public boolean add(int it) { return true; }
// from the supertype
// public default boolen add(Integer it) { return true; }
}
// FILE: AbstractIntSet.java
public abstract class AbstractIntSet extends AbstractIntCollection implements IntSet {}
// FILE: Main.kt
<!CANNOT_INFER_VISIBILITY!>class KotlinClass<!> : AbstractIntSet()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM
// FILE: IntCollection.java