[FIR] Implement FUNCTION_CALL_EXPECTED

This commit is contained in:
Ivan Kochurkin
2021-06-22 23:23:02 +03:00
parent d048bccfa2
commit 59257e47c9
21 changed files with 106 additions and 65 deletions
@@ -283,6 +283,14 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.FUNCTION_CALL_EXPECTED) { firDiagnostic ->
FunctionCallExpectedImpl(
firDiagnostic.a,
firDiagnostic.b,
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirErrors.SUPER_IS_NOT_AN_EXPRESSION) { firDiagnostic ->
SuperIsNotAnExpressionImpl(
firDiagnostic as FirPsiDiagnostic,
@@ -220,6 +220,12 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = CreatingAnInstanceOfAbstractClass::class
}
abstract class FunctionCallExpected : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = FunctionCallExpected::class
abstract val functionName: String
abstract val hasValueParameters: Boolean
}
abstract class SuperIsNotAnExpression : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = SuperIsNotAnExpression::class
}
@@ -329,6 +329,15 @@ internal class CreatingAnInstanceOfAbstractClassImpl(
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class FunctionCallExpectedImpl(
override val functionName: String,
override val hasValueParameters: Boolean,
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.FunctionCallExpected(), KtAbstractFirDiagnostic<PsiElement> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class SuperIsNotAnExpressionImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
+2 -2
View File
@@ -18,8 +18,8 @@ fun test(l : List<Int>) {
val f : java.io.File? = null
Collections.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: emptyList">emptyList</error>
Collections.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: emptyList">emptyList</error><Int>
Collections.<error descr="[FUNCTION_CALL_EXPECTED] Function invocation 'emptyList()' expected">emptyList</error>
Collections.<error descr="[FUNCTION_CALL_EXPECTED] Function invocation 'emptyList()' expected">emptyList</error><<error descr="[CANNOT_INFER_PARAMETER_TYPE] cannot infer a type for this parameter. Please specify it explicitly.">Int</error>>
Collections.emptyList<Int>()
Collections.<error descr="[NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER] T">emptyList</error>()