[FIR] Add TYPE_PARAMETERS_NOT_ALLOWED check
This commit is contained in:
committed by
TeamCityServer
parent
5ff82addc9
commit
470993ac07
+6
@@ -998,6 +998,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.TYPE_PARAMETERS_NOT_ALLOWED) { firDiagnostic ->
|
||||
TypeParametersNotAllowedImpl(
|
||||
firDiagnostic as FirPsiDiagnostic<*>,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.RETURN_TYPE_MISMATCH) { firDiagnostic ->
|
||||
ReturnTypeMismatchImpl(
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||
|
||||
+4
@@ -709,6 +709,10 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = ReifiedTypeParameterNoInline::class
|
||||
}
|
||||
|
||||
abstract class TypeParametersNotAllowed : KtFirDiagnostic<KtDeclaration>() {
|
||||
override val diagnosticClass get() = TypeParametersNotAllowed::class
|
||||
}
|
||||
|
||||
abstract class ReturnTypeMismatch : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = ReturnTypeMismatch::class
|
||||
abstract val expected: KtType
|
||||
|
||||
+7
@@ -1145,6 +1145,13 @@ internal class ReifiedTypeParameterNoInlineImpl(
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class TypeParametersNotAllowedImpl(
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.TypeParametersNotAllowed(), KtAbstractFirDiagnostic<KtDeclaration> {
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class ReturnTypeMismatchImpl(
|
||||
override val expected: KtType,
|
||||
override val actual: KtType,
|
||||
|
||||
Reference in New Issue
Block a user