[FIR] Prohibit class literals with empty left-hand side
^KT-59165 Fixed
This commit is contained in:
committed by
Space Team
parent
d748fe7696
commit
713c2136cc
+6
@@ -2440,6 +2440,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS) { firDiagnostic ->
|
||||
UnsupportedClassLiteralsWithEmptyLhsImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.NOTHING_TO_OVERRIDE) { firDiagnostic ->
|
||||
NothingToOverrideImpl(
|
||||
firSymbolBuilder.callableBuilder.buildCallableSymbol(firDiagnostic.a),
|
||||
|
||||
+4
@@ -1730,6 +1730,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
val lhsType: KtType
|
||||
}
|
||||
|
||||
interface UnsupportedClassLiteralsWithEmptyLhs : KtFirDiagnostic<KtElement> {
|
||||
override val diagnosticClass get() = UnsupportedClassLiteralsWithEmptyLhs::class
|
||||
}
|
||||
|
||||
interface NothingToOverride : KtFirDiagnostic<KtModifierListOwner> {
|
||||
override val diagnosticClass get() = NothingToOverride::class
|
||||
val declaration: KtCallableSymbol
|
||||
|
||||
+5
@@ -2080,6 +2080,11 @@ internal class ExpressionOfNullableTypeInClassLiteralLhsImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.ExpressionOfNullableTypeInClassLiteralLhs
|
||||
|
||||
internal class UnsupportedClassLiteralsWithEmptyLhsImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.UnsupportedClassLiteralsWithEmptyLhs
|
||||
|
||||
internal class NothingToOverrideImpl(
|
||||
override val declaration: KtCallableSymbol,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
|
||||
+6
@@ -297,6 +297,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/Dollar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryAsType.kt")
|
||||
public void testEnumEntryAsType() throws Exception {
|
||||
|
||||
+6
@@ -297,6 +297,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/Dollar.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumEntryAsType.kt")
|
||||
public void testEnumEntryAsType() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user