[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:
committed by
Space Team
parent
053eb07692
commit
76ed5453b3
+3
-3
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
object PositioningStrategies {
|
||||
open class DeclarationHeader<T : KtDeclaration> : PositioningStrategy<T>() {
|
||||
open class DeclarationHeader<T : PsiElement> : PositioningStrategy<T>() {
|
||||
override fun isValid(element: T): Boolean {
|
||||
if (element is KtNamedDeclaration &&
|
||||
element !is KtObjectDeclaration &&
|
||||
@@ -142,8 +142,8 @@ object PositioningStrategies {
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val DECLARATION_NAME: PositioningStrategy<KtNamedDeclaration> = object : DeclarationHeader<KtNamedDeclaration>() {
|
||||
override fun mark(element: KtNamedDeclaration): List<TextRange> {
|
||||
val DECLARATION_NAME: PositioningStrategy<PsiNameIdentifierOwner> = object : DeclarationHeader<PsiNameIdentifierOwner>() {
|
||||
override fun mark(element: PsiNameIdentifierOwner): List<TextRange> {
|
||||
val nameIdentifier = element.nameIdentifier
|
||||
if (nameIdentifier != null) {
|
||||
if (element is KtClassOrObject) {
|
||||
|
||||
Reference in New Issue
Block a user