K2: support ForbidInferringTypeVariablesIntoEmptyIntersection on/off
This commit is contained in:
committed by
Space Team
parent
f7544aff62
commit
b64cb67370
+14
-2
@@ -2224,8 +2224,20 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION) { firDiagnostic ->
|
||||
InferredTypeVariableIntoEmptyIntersectionImpl(
|
||||
add(FirErrors.INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION.errorFactory) { firDiagnostic ->
|
||||
InferredTypeVariableIntoEmptyIntersectionErrorImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic.b.map { coneKotlinType ->
|
||||
firSymbolBuilder.typeBuilder.buildKtType(coneKotlinType)
|
||||
},
|
||||
firDiagnostic.c,
|
||||
firDiagnostic.d,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION.warningFactory) { firDiagnostic ->
|
||||
InferredTypeVariableIntoEmptyIntersectionWarningImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic.b.map { coneKotlinType ->
|
||||
firSymbolBuilder.typeBuilder.buildKtType(coneKotlinType)
|
||||
|
||||
+10
-2
@@ -1579,8 +1579,16 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract val kotlinClass: FqName
|
||||
}
|
||||
|
||||
abstract class InferredTypeVariableIntoEmptyIntersection : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = InferredTypeVariableIntoEmptyIntersection::class
|
||||
abstract class InferredTypeVariableIntoEmptyIntersectionError : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = InferredTypeVariableIntoEmptyIntersectionError::class
|
||||
abstract val typeVariableDescription: String
|
||||
abstract val incompatibleTypes: List<KtType>
|
||||
abstract val description: String
|
||||
abstract val causingTypes: String
|
||||
}
|
||||
|
||||
abstract class InferredTypeVariableIntoEmptyIntersectionWarning : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = InferredTypeVariableIntoEmptyIntersectionWarning::class
|
||||
abstract val typeVariableDescription: String
|
||||
abstract val incompatibleTypes: List<KtType>
|
||||
abstract val description: String
|
||||
|
||||
+11
-2
@@ -1899,14 +1899,23 @@ internal class PlatformClassMappedToKotlinImpl(
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.PlatformClassMappedToKotlin(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class InferredTypeVariableIntoEmptyIntersectionImpl(
|
||||
internal class InferredTypeVariableIntoEmptyIntersectionErrorImpl(
|
||||
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>
|
||||
) : KtFirDiagnostic.InferredTypeVariableIntoEmptyIntersectionError(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class InferredTypeVariableIntoEmptyIntersectionWarningImpl(
|
||||
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.InferredTypeVariableIntoEmptyIntersectionWarning(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class InferredTypeVariableIntoPossibleEmptyIntersectionImpl(
|
||||
override val typeVariableDescription: String,
|
||||
|
||||
Reference in New Issue
Block a user