[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
+1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.analysis.api.fir.diagnostics
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNameIdentifierOwner
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.kotlin.KtPsiSourceElement
|
||||
import org.jetbrains.kotlin.diagnostics.KtPsiDiagnostic
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.analysis.api.fir.diagnostics
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNameIdentifierOwner
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.kotlin.analysis.api.diagnostics.KtDiagnosticWithPsi
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
@@ -1927,7 +1928,7 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
val containingClassName: Name
|
||||
}
|
||||
|
||||
interface CannotInferVisibility : KtFirDiagnostic<KtDeclaration> {
|
||||
interface CannotInferVisibility : KtFirDiagnostic<PsiNameIdentifierOwner> {
|
||||
override val diagnosticClass get() = CannotInferVisibility::class
|
||||
val callable: KtCallableSymbol
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.analysis.api.fir.diagnostics
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNameIdentifierOwner
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
@@ -2319,7 +2320,7 @@ internal class CannotInferVisibilityImpl(
|
||||
override val callable: KtCallableSymbol,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtDeclaration>(firDiagnostic, token), KtFirDiagnostic.CannotInferVisibility
|
||||
) : KtAbstractFirDiagnostic<PsiNameIdentifierOwner>(firDiagnostic, token), KtFirDiagnostic.CannotInferVisibility
|
||||
|
||||
internal class MultipleDefaultsInheritedFromSupertypesImpl(
|
||||
override val name: Name,
|
||||
|
||||
Reference in New Issue
Block a user