FIR IDE: pass candidate super types for AMBIGUOUS_SUPER

This way the IDE quickfix do not need to do resolution again to figure
out what super type to offer in the quickfix.
This commit is contained in:
Tianyu Geng
2021-10-12 16:21:48 -07:00
committed by Ilya Kirillov
parent 7c3706dd3f
commit bdc71a3281
11 changed files with 33 additions and 18 deletions
@@ -569,6 +569,9 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
}
add(FirErrors.AMBIGUOUS_SUPER) { firDiagnostic ->
AmbiguousSuperImpl(
firDiagnostic.a.map { coneKotlinType ->
firSymbolBuilder.typeBuilder.buildKtType(coneKotlinType)
},
firDiagnostic as FirPsiDiagnostic,
token,
)
@@ -425,6 +425,7 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
abstract class AmbiguousSuper : KtFirDiagnostic<KtSuperExpression>() {
override val diagnosticClass get() = AmbiguousSuper::class
abstract val candidates: List<KtType>
}
abstract class ConstructorInObject : KtFirDiagnostic<KtDeclaration>() {
@@ -500,6 +500,7 @@ internal class InconsistentTypeParameterBoundsImpl(
) : KtFirDiagnostic.InconsistentTypeParameterBounds(), KtAbstractFirDiagnostic<PsiElement>
internal class AmbiguousSuperImpl(
override val candidates: List<KtType>,
override val firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.AmbiguousSuper(), KtAbstractFirDiagnostic<KtSuperExpression>