[FIR] Forbid multiple labels per statement
^KT-53629: Fixed
This commit is contained in:
committed by
Space Team
parent
cd5b38b958
commit
d27adf6677
+6
@@ -4957,6 +4957,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.MULTIPLE_LABELS_ARE_FORBIDDEN) { firDiagnostic ->
|
||||
MultipleLabelsAreForbiddenImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.DEPRECATED_ACCESS_TO_ENUM_ENTRY_COMPANION_PROPERTY) { firDiagnostic ->
|
||||
DeprecatedAccessToEnumEntryCompanionPropertyImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
|
||||
+4
@@ -3450,6 +3450,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = RedundantLabelWarning::class
|
||||
}
|
||||
|
||||
interface MultipleLabelsAreForbidden : KtFirDiagnostic<KtLabelReferenceExpression> {
|
||||
override val diagnosticClass get() = MultipleLabelsAreForbidden::class
|
||||
}
|
||||
|
||||
interface DeprecatedAccessToEnumEntryCompanionProperty : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = DeprecatedAccessToEnumEntryCompanionProperty::class
|
||||
}
|
||||
|
||||
+5
@@ -4161,6 +4161,11 @@ internal class RedundantLabelWarningImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtLabelReferenceExpression>(firDiagnostic, token), KtFirDiagnostic.RedundantLabelWarning
|
||||
|
||||
internal class MultipleLabelsAreForbiddenImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtLabelReferenceExpression>(firDiagnostic, token), KtFirDiagnostic.MultipleLabelsAreForbidden
|
||||
|
||||
internal class DeprecatedAccessToEnumEntryCompanionPropertyImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
|
||||
+6
@@ -23901,6 +23901,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
public void testLabelsMustBeNamed() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multipleLabels.kt")
|
||||
public void testMultipleLabels() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/labels/multipleLabels.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -23901,6 +23901,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
public void testLabelsMustBeNamed() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multipleLabels.kt")
|
||||
public void testMultipleLabels() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/labels/multipleLabels.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user