[K2] Warn about deprecation and opt-in markers for overrides of Any

^KT-62620 Fixed

Include opt-in markers in the diagnostics
This commit is contained in:
Alejandro Serrano Mena
2023-10-16 16:00:40 +02:00
committed by Space Team
parent 6afe716238
commit b9b15cba08
17 changed files with 300 additions and 1 deletions
@@ -1195,6 +1195,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.POTENTIALLY_NON_REPORTED_ANNOTATION) { firDiagnostic ->
PotentiallyNonReportedAnnotationImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirJsErrors.WRONG_JS_QUALIFIER) { firDiagnostic ->
WrongJsQualifierImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -867,6 +867,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = NonSourceAnnotationOnInlinedLambdaExpression::class
}
interface PotentiallyNonReportedAnnotation : KtFirDiagnostic<KtAnnotationEntry> {
override val diagnosticClass get() = PotentiallyNonReportedAnnotation::class
}
interface WrongJsQualifier : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = WrongJsQualifier::class
}
@@ -1038,6 +1038,11 @@ internal class NonSourceAnnotationOnInlinedLambdaExpressionImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtAnnotationEntry>(firDiagnostic, token), KtFirDiagnostic.NonSourceAnnotationOnInlinedLambdaExpression
internal class PotentiallyNonReportedAnnotationImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtAnnotationEntry>(firDiagnostic, token), KtFirDiagnostic.PotentiallyNonReportedAnnotation
internal class WrongJsQualifierImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
@@ -1878,6 +1878,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/annotations/Deprecated.kt");
}
@Test
@TestMetadata("DeprecationOnAny.kt")
public void testDeprecationOnAny() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/DeprecationOnAny.kt");
}
@Test
@TestMetadata("dontReportWarningAboutChangingExecutionOrderForVararg.kt")
public void testDontReportWarningAboutChangingExecutionOrderForVararg() throws Exception {
@@ -1878,6 +1878,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/annotations/Deprecated.kt");
}
@Test
@TestMetadata("DeprecationOnAny.kt")
public void testDeprecationOnAny() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/DeprecationOnAny.kt");
}
@Test
@TestMetadata("dontReportWarningAboutChangingExecutionOrderForVararg.kt")
public void testDontReportWarningAboutChangingExecutionOrderForVararg() throws Exception {