[FE] Show causing types in the INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION diagnostic
This commit is contained in:
committed by
teamcity
parent
6a34b184ac
commit
867ad24c86
+14
@@ -1982,6 +1982,20 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
firDiagnostic.b.map { coneKotlinType ->
|
||||
firSymbolBuilder.typeBuilder.buildKtType(coneKotlinType)
|
||||
},
|
||||
firDiagnostic.c,
|
||||
firDiagnostic.d,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION) { firDiagnostic ->
|
||||
InferredTypeVariableIntoPossibleEmptyIntersectionImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic.b.map { coneKotlinType ->
|
||||
firSymbolBuilder.typeBuilder.buildKtType(coneKotlinType)
|
||||
},
|
||||
firDiagnostic.c,
|
||||
firDiagnostic.d,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
|
||||
+10
@@ -1409,6 +1409,16 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = InferredTypeVariableIntoEmptyIntersection::class
|
||||
abstract val typeVariableDescription: String
|
||||
abstract val incompatibleTypes: List<KtType>
|
||||
abstract val description: String
|
||||
abstract val causingTypes: String
|
||||
}
|
||||
|
||||
abstract class InferredTypeVariableIntoPossibleEmptyIntersection : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = InferredTypeVariableIntoPossibleEmptyIntersection::class
|
||||
abstract val typeVariableDescription: String
|
||||
abstract val incompatibleTypes: List<KtType>
|
||||
abstract val description: String
|
||||
abstract val causingTypes: String
|
||||
}
|
||||
|
||||
abstract class ExtensionInClassReferenceNotAllowed : KtFirDiagnostic<KtExpression>() {
|
||||
|
||||
+11
@@ -1690,10 +1690,21 @@ internal class PlatformClassMappedToKotlinImpl(
|
||||
internal class InferredTypeVariableIntoEmptyIntersectionImpl(
|
||||
override val typeVariableDescription: String,
|
||||
override val incompatibleTypes: List<KtType>,
|
||||
override val description: String,
|
||||
override val causingTypes: String,
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.InferredTypeVariableIntoEmptyIntersection(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class InferredTypeVariableIntoPossibleEmptyIntersectionImpl(
|
||||
override val typeVariableDescription: String,
|
||||
override val incompatibleTypes: List<KtType>,
|
||||
override val description: String,
|
||||
override val causingTypes: String,
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.InferredTypeVariableIntoPossibleEmptyIntersection(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class ExtensionInClassReferenceNotAllowedImpl(
|
||||
override val referencedDeclaration: KtCallableSymbol,
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
|
||||
+3
-2
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LLFirResolveSession
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFirFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFirOfType
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.resolveToFirSymbolOfType
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.renderWithType
|
||||
@@ -89,7 +88,9 @@ internal class KtFirSymbolProvider(
|
||||
}
|
||||
|
||||
override fun getAnonymousFunctionSymbol(psi: KtNamedFunction): KtAnonymousFunctionSymbol = withValidityAssertion {
|
||||
firSymbolBuilder.functionLikeBuilder.buildAnonymousFunctionSymbol(psi.getOrBuildFirOfType(firResolveSession))
|
||||
firSymbolBuilder.functionLikeBuilder.buildAnonymousFunctionSymbol(
|
||||
psi.resolveToFirSymbolOfType<FirAnonymousFunctionSymbol>(firResolveSession)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getAnonymousFunctionSymbol(psi: KtFunctionLiteral): KtAnonymousFunctionSymbol = withValidityAssertion {
|
||||
|
||||
Reference in New Issue
Block a user