[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`.
This commit is contained in:
Nikolay Lunyak
2024-02-20 14:20:22 +02:00
committed by Space Team
parent 053eb07692
commit 76ed5453b3
27 changed files with 149 additions and 46 deletions
@@ -0,0 +1,19 @@
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
interface One {
public <!REDUNDANT_OPEN_IN_INTERFACE!>open<!> fun foo() : Int
private fun boo() = 10
}
interface Two {
public <!REDUNDANT_OPEN_IN_INTERFACE!>open<!> fun foo() : Int
}
interface OneImpl : One {
public override fun foo() = 1
}
interface TwoImpl : Two {
public override fun foo() = 2
}
<!CANNOT_INFER_VISIBILITY, MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class Test1<!>() : TwoImpl, OneImpl {}
class Test2(a : One) : One by a, Two {}
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test3<!>(a : One, b : Two) : Two by b, One by a {}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
interface One {
public <!REDUNDANT_OPEN_IN_INTERFACE!>open<!> fun foo() : Int