FIR: support more precise diagnostics about parameter names
#KT-52762 Fixed
This commit is contained in:
+6
@@ -1482,6 +1482,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.NAME_FOR_AMBIGUOUS_PARAMETER) { firDiagnostic ->
|
||||
NameForAmbiguousParameterImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.ASSIGNMENT_TYPE_MISMATCH) { firDiagnostic ->
|
||||
AssignmentTypeMismatchImpl(
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||
|
||||
+4
@@ -1063,6 +1063,10 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract val name: String
|
||||
}
|
||||
|
||||
abstract class NameForAmbiguousParameter : KtFirDiagnostic<KtValueArgument>() {
|
||||
override val diagnosticClass get() = NameForAmbiguousParameter::class
|
||||
}
|
||||
|
||||
abstract class AssignmentTypeMismatch : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = AssignmentTypeMismatch::class
|
||||
abstract val expectedType: KtType
|
||||
|
||||
+5
@@ -1274,6 +1274,11 @@ internal class NamedParameterNotFoundImpl(
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.NamedParameterNotFound(), KtAbstractFirDiagnostic<KtValueArgument>
|
||||
|
||||
internal class NameForAmbiguousParameterImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.NameForAmbiguousParameter(), KtAbstractFirDiagnostic<KtValueArgument>
|
||||
|
||||
internal class AssignmentTypeMismatchImpl(
|
||||
override val expectedType: KtType,
|
||||
override val actualType: KtType,
|
||||
|
||||
Reference in New Issue
Block a user