[FIR] Don't lose error level enhancements in warning-level-enhanced arguments

The error-level enhancement is kept as warning-level and a new
LanguageFeature is introduced to turn the warning into an error.

#KT-63208 Fixed
#KT-63209
This commit is contained in:
Kirill Rakhman
2024-01-05 15:14:29 +01:00
committed by Space Team
parent 9189154cae
commit 371b1eb3d5
22 changed files with 470 additions and 33 deletions
@@ -5091,6 +5091,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
ReceiverNullabilityMismatchBasedOnJavaAnnotationsImpl(
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.b),
firDiagnostic.c,
firDiagnostic as KtPsiDiagnostic,
token,
)
@@ -5099,6 +5100,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
NullabilityMismatchBasedOnJavaAnnotationsImpl(
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.b),
firDiagnostic.c,
firDiagnostic as KtPsiDiagnostic,
token,
)
@@ -3544,12 +3544,14 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = ReceiverNullabilityMismatchBasedOnJavaAnnotations::class
val actualType: KtType
val expectedType: KtType
val messageSuffix: String
}
interface NullabilityMismatchBasedOnJavaAnnotations : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = NullabilityMismatchBasedOnJavaAnnotations::class
val actualType: KtType
val expectedType: KtType
val messageSuffix: String
}
interface UpperBoundCannotBeArray : KtFirDiagnostic<PsiElement> {
@@ -4274,6 +4274,7 @@ internal class JavaTypeMismatchImpl(
internal class ReceiverNullabilityMismatchBasedOnJavaAnnotationsImpl(
override val actualType: KtType,
override val expectedType: KtType,
override val messageSuffix: String,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.ReceiverNullabilityMismatchBasedOnJavaAnnotations
@@ -4281,6 +4282,7 @@ internal class ReceiverNullabilityMismatchBasedOnJavaAnnotationsImpl(
internal class NullabilityMismatchBasedOnJavaAnnotationsImpl(
override val actualType: KtType,
override val expectedType: KtType,
override val messageSuffix: String,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.NullabilityMismatchBasedOnJavaAnnotations