[FIR] Implement FUNCTION_EXPECTED

This commit is contained in:
Ivan Kochurkin
2021-06-29 22:06:44 +03:00
parent 263e40e753
commit 2574dc907c
32 changed files with 146 additions and 58 deletions
@@ -327,6 +327,14 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.FUNCTION_EXPECTED) { firDiagnostic ->
FunctionExpectedImpl(
firDiagnostic.a,
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.b),
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirErrors.SUPER_IS_NOT_AN_EXPRESSION) { firDiagnostic ->
SuperIsNotAnExpressionImpl(
firDiagnostic as FirPsiDiagnostic,
@@ -257,6 +257,12 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = NoReceiverAllowed::class
}
abstract class FunctionExpected : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = FunctionExpected::class
abstract val expression: String
abstract val type: KtType
}
abstract class SuperIsNotAnExpression : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = SuperIsNotAnExpression::class
}
@@ -381,6 +381,15 @@ internal class NoReceiverAllowedImpl(
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class FunctionExpectedImpl(
override val expression: String,
override val type: KtType,
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.FunctionExpected(), KtAbstractFirDiagnostic<PsiElement> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class SuperIsNotAnExpressionImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,