[FIR] Add TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER check

This commit is contained in:
Andrey Zinovyev
2021-04-12 13:40:27 +03:00
committed by TeamCityServer
parent 470993ac07
commit 03215f4e0a
19 changed files with 75 additions and 95 deletions
@@ -1004,6 +1004,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER) { firDiagnostic ->
TypeParameterOfPropertyNotUsedInReceiverImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.RETURN_TYPE_MISMATCH) { firDiagnostic ->
ReturnTypeMismatchImpl(
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
@@ -713,6 +713,10 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = TypeParametersNotAllowed::class
}
abstract class TypeParameterOfPropertyNotUsedInReceiver : KtFirDiagnostic<KtTypeParameter>() {
override val diagnosticClass get() = TypeParameterOfPropertyNotUsedInReceiver::class
}
abstract class ReturnTypeMismatch : KtFirDiagnostic<KtExpression>() {
override val diagnosticClass get() = ReturnTypeMismatch::class
abstract val expected: KtType
@@ -1152,6 +1152,13 @@ internal class TypeParametersNotAllowedImpl(
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class TypeParameterOfPropertyNotUsedInReceiverImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.TypeParameterOfPropertyNotUsedInReceiver(), KtAbstractFirDiagnostic<KtTypeParameter> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class ReturnTypeMismatchImpl(
override val expected: KtType,
override val actual: KtType,