[FIR] KT-46483: Forbid annotations in where Clauses
Merge-request: KT-MR-7208 Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
This commit is contained in:
+6
@@ -955,6 +955,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.ANNOTATION_IN_WHERE_CLAUSE_ERROR) { firDiagnostic ->
|
||||
AnnotationInWhereClauseErrorImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.OPT_IN_USAGE) { firDiagnostic ->
|
||||
OptInUsageImpl(
|
||||
firDiagnostic.a,
|
||||
|
||||
+4
@@ -689,6 +689,10 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = WrongExtensionFunctionTypeWarning::class
|
||||
}
|
||||
|
||||
abstract class AnnotationInWhereClauseError : KtFirDiagnostic<KtAnnotationEntry>() {
|
||||
override val diagnosticClass get() = AnnotationInWhereClauseError::class
|
||||
}
|
||||
|
||||
abstract class OptInUsage : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = OptInUsage::class
|
||||
abstract val optInMarkerFqName: FqName
|
||||
|
||||
+5
@@ -827,6 +827,11 @@ internal class WrongExtensionFunctionTypeWarningImpl(
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.WrongExtensionFunctionTypeWarning(), KtAbstractFirDiagnostic<KtAnnotationEntry>
|
||||
|
||||
internal class AnnotationInWhereClauseErrorImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.AnnotationInWhereClauseError(), KtAbstractFirDiagnostic<KtAnnotationEntry>
|
||||
|
||||
internal class OptInUsageImpl(
|
||||
override val optInMarkerFqName: FqName,
|
||||
override val message: String,
|
||||
|
||||
+6
@@ -423,6 +423,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/kt435.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46483.kt")
|
||||
public void testKt46483() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/kt46483.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49438.kt")
|
||||
public void testKt49438() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user