[FIR] Add SYNCHRONIZED_* diagnostics

This commit is contained in:
Andrey Zinovyev
2021-08-17 14:37:21 +03:00
committed by TeamCityServer
parent 7ba8e0d9cc
commit 17ae69416c
11 changed files with 107 additions and 51 deletions
@@ -3457,6 +3457,24 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirJvmErrors.SYNCHRONIZED_ON_ABSTRACT) { firDiagnostic ->
SynchronizedOnAbstractImpl(
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirJvmErrors.SYNCHRONIZED_IN_INTERFACE) { firDiagnostic ->
SynchronizedInInterfaceImpl(
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirJvmErrors.SYNCHRONIZED_ON_INLINE) { firDiagnostic ->
SynchronizedOnInlineImpl(
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirJvmErrors.JAVA_TYPE_MISMATCH) { firDiagnostic ->
JavaTypeMismatchImpl(
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
@@ -2410,6 +2410,18 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = VolatileOnDelegate::class
}
abstract class SynchronizedOnAbstract : KtFirDiagnostic<KtAnnotationEntry>() {
override val diagnosticClass get() = SynchronizedOnAbstract::class
}
abstract class SynchronizedInInterface : KtFirDiagnostic<KtAnnotationEntry>() {
override val diagnosticClass get() = SynchronizedInInterface::class
}
abstract class SynchronizedOnInline : KtFirDiagnostic<KtAnnotationEntry>() {
override val diagnosticClass get() = SynchronizedOnInline::class
}
abstract class JavaTypeMismatch : KtFirDiagnostic<KtExpression>() {
override val diagnosticClass get() = JavaTypeMismatch::class
abstract val expectedType: KtType
@@ -3899,6 +3899,27 @@ internal class VolatileOnDelegateImpl(
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class SynchronizedOnAbstractImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.SynchronizedOnAbstract(), KtAbstractFirDiagnostic<KtAnnotationEntry> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class SynchronizedInInterfaceImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.SynchronizedInInterface(), KtAbstractFirDiagnostic<KtAnnotationEntry> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class SynchronizedOnInlineImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.SynchronizedOnInline(), KtAbstractFirDiagnostic<KtAnnotationEntry> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class JavaTypeMismatchImpl(
override val expectedType: KtType,
override val actualType: KtType,