[FIR] Report UNSUPPORTED_SEALED_FUN_INTERFACE

^KT-59957 Fixed
This commit is contained in:
Nikolay Lunyak
2023-08-07 12:25:36 +03:00
committed by Space Team
parent 8be98da1d3
commit b7d1298f20
10 changed files with 47 additions and 15 deletions
@@ -650,6 +650,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.UNSUPPORTED_SEALED_FUN_INTERFACE) { firDiagnostic ->
UnsupportedSealedFunInterfaceImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.SUPERTYPE_NOT_A_CLASS_OR_INTERFACE) { firDiagnostic ->
SupertypeNotAClassOrInterfaceImpl(
firDiagnostic.a,
@@ -497,6 +497,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = ClassInheritsJavaSealedClass::class
}
interface UnsupportedSealedFunInterface : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = UnsupportedSealedFunInterface::class
}
interface SupertypeNotAClassOrInterface : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = SupertypeNotAClassOrInterface::class
val reason: String
@@ -584,6 +584,11 @@ internal class ClassInheritsJavaSealedClassImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtTypeReference>(firDiagnostic, token), KtFirDiagnostic.ClassInheritsJavaSealedClass
internal class UnsupportedSealedFunInterfaceImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.UnsupportedSealedFunInterface
internal class SupertypeNotAClassOrInterfaceImpl(
override val reason: String,
firDiagnostic: KtPsiDiagnostic,