Files
kotlin-fork/compiler/testData/diagnostics/tests/intersectionWithMultipleDefaultsInJava.fir.kt
T
Nikolay Lunyak 76ed5453b3 [FIR] Report all Visibilities.Unknown in FirOverrideChecker
Check all members for `Visibility.Unknown`,
otherwise we miss them when they come
from supertypes. This is the reason why
the FP intellij build failed with a
cryptic stacktrace instead of a
human-readable diagnostic.

Also, do report the diagnostic at all
cases of `Visibilities.Unknown`. Turns
out, there are no "simple to reason
about" situations here :(

Also, an interesting detail:
`retrieveDirectOverriddenOf` returns an
empty list for intersection overrides.
But this doesn't seem to break anything...

Replacing `CANNOT_INFER_VISIBILITY`'s
type `KtDeclaration` with
`PsiNameIdentifierOwner` and the related
changes in `PositioningStrategies`
were needed to prevent an exception saying that
`PsiClassImpl` is not a subtype of
`KtDeclaration`.
2024-02-21 20:24:13 +00:00

35 lines
880 B
Kotlin
Vendored

// 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()