[FE] Support reporting INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION for empty intersection types with type parameters
This commit is contained in:
committed by
teamcity
parent
c16ae81a48
commit
b96708c3e2
+10
@@ -1976,6 +1976,16 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION) { firDiagnostic ->
|
||||
InferredTypeVariableIntoEmptyIntersectionImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic.b.map { coneKotlinType ->
|
||||
firSymbolBuilder.typeBuilder.buildKtType(coneKotlinType)
|
||||
},
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED) { firDiagnostic ->
|
||||
ExtensionInClassReferenceNotAllowedImpl(
|
||||
firSymbolBuilder.callableBuilder.buildCallableSymbol(firDiagnostic.a),
|
||||
|
||||
+6
@@ -1405,6 +1405,12 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract val kotlinClass: FqName
|
||||
}
|
||||
|
||||
abstract class InferredTypeVariableIntoEmptyIntersection : KtFirDiagnostic<PsiElement>() {
|
||||
override val diagnosticClass get() = InferredTypeVariableIntoEmptyIntersection::class
|
||||
abstract val typeVariableDescription: String
|
||||
abstract val incompatibleTypes: List<KtType>
|
||||
}
|
||||
|
||||
abstract class ExtensionInClassReferenceNotAllowed : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = ExtensionInClassReferenceNotAllowed::class
|
||||
abstract val referencedDeclaration: KtCallableSymbol
|
||||
|
||||
+7
@@ -1687,6 +1687,13 @@ internal class PlatformClassMappedToKotlinImpl(
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.PlatformClassMappedToKotlin(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class InferredTypeVariableIntoEmptyIntersectionImpl(
|
||||
override val typeVariableDescription: String,
|
||||
override val incompatibleTypes: List<KtType>,
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.InferredTypeVariableIntoEmptyIntersection(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class ExtensionInClassReferenceNotAllowedImpl(
|
||||
override val referencedDeclaration: KtCallableSymbol,
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
|
||||
+24
@@ -13840,6 +13840,30 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt45461.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_2.kt")
|
||||
public void testKt45461_2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt45461_2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_3.kt")
|
||||
public void testKt45461_3() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt45461_3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_4.kt")
|
||||
public void testKt45461_4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt45461_4.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45461_5.kt")
|
||||
public void testKt45461_5() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt45461_5.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46515.kt")
|
||||
public void testKt46515() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user