FIR: Implement more precise reporting diagnostics from new inference
This commit is contained in:
committed by
teamcityserver
parent
c67ae8a0a3
commit
c46d049394
+7
@@ -71,6 +71,13 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.NEW_INFERENCE_ERROR) { firDiagnostic ->
|
||||
NewInferenceErrorImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic as FirPsiDiagnostic<*>,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.SYNTAX) { firDiagnostic ->
|
||||
SyntaxImpl(
|
||||
firDiagnostic as FirPsiDiagnostic<*>,
|
||||
|
||||
+5
@@ -74,6 +74,11 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract val unsupportedFeature: Pair<LanguageFeature, LanguageVersionSettings>
|
||||
}
|
||||
|
||||
abstract class NewInferenceError : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = NewInferenceError::class
|
||||
abstract val error: String
|
||||
}
|
||||
|
||||
abstract class Syntax : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = Syntax::class
|
||||
}
|
||||
|
||||
+8
@@ -81,6 +81,14 @@ internal class UnsupportedFeatureImpl(
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class NewInferenceErrorImpl(
|
||||
override val error: String,
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.NewInferenceError(), KtAbstractFirDiagnostic<PsiElement> {
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class SyntaxImpl(
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
|
||||
Reference in New Issue
Block a user