76ed5453b3
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`.
29 lines
956 B
Kotlin
Vendored
29 lines
956 B
Kotlin
Vendored
// LANGUAGE: +ProhibitImplementingVarByInheritedVal
|
|
|
|
interface IVal {
|
|
val a: String
|
|
}
|
|
interface IVar {
|
|
var a: String
|
|
}
|
|
interface IVarDefault {
|
|
var a: String
|
|
get() = ""
|
|
set(value) {}
|
|
}
|
|
open class CVal {
|
|
val a: String = "default"
|
|
}
|
|
open class CVar {
|
|
var a: String = "default"
|
|
}
|
|
|
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class C1<!> : IVar, IVarDefault
|
|
<!VAR_IMPLEMENTED_BY_INHERITED_VAL_ERROR!>class C2<!> : CVal(), IVar
|
|
<!CANNOT_INFER_VISIBILITY, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class C3<!> : CVal(), IVarDefault
|
|
<!CANNOT_INFER_VISIBILITY, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class C4<!> : CVal(), IVar, IVarDefault
|
|
class C5 : CVar(), IVar
|
|
<!CANNOT_INFER_VISIBILITY, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class C6<!> : CVar(), IVarDefault
|
|
<!CANNOT_INFER_VISIBILITY, MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class C7<!> : CVar(), IVar, IVarDefault
|
|
<!VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class C8<!>(ival: IVal) : IVar, IVal by ival
|