Files
kotlin-fork/compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.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

49 lines
1.1 KiB
Kotlin
Vendored

// !RENDER_DIAGNOSTICS_MESSAGES
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class An
@An
interface A {
@An
fun a(@An arg: @An Int)
}
@An
interface B {
@An
fun <T> a(@An arg: @An Int)
}
<!CONFLICTING_INHERITED_MEMBERS("C; '@An() fun a(@An() arg: @An() Int): Unit' defined in '/A', '@An() fun <T> a(@An() arg: @An() Int): Unit' defined in '/B'")!>interface C<!> : A, B
@An
abstract class D {
@An
abstract val d: @An Int
}
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED("Class 'E'; d")!>class E<!> : D(), A
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED("Class 'F'; a")!>class F<!> : A
@An
interface G {
@An
fun a(@An arg: @An Int)
}
@An
interface AI : A {
@An
override fun a(@An arg: @An Int) {}
}
@An
interface GI : G {
@An
override fun a(@An arg: @An Int) {}
}
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED("Class 'AG1'; a")!>class AG1<!>(val a: A, val g: G) : A by a, G by g
<!CANNOT_INFER_VISIBILITY("a"), MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED("Class 'AG2'; a")!>class AG2<!>() : AI, GI