[FIR] Implement EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE

^KT-60367 Fixed
KT review: https://jetbrains.team/p/kt/reviews/14064/timeline
IJ review: https://jetbrains.team/p/ij/reviews/124657/timeline
This commit is contained in:
Nikita Bobko
2024-01-17 19:36:28 +01:00
committed by teamcity
parent b317a88536
commit c214c5445a
25 changed files with 254 additions and 36 deletions
@@ -3042,6 +3042,13 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE) { firDiagnostic ->
ExpectAndActualInTheSameModuleImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE) { firDiagnostic ->
MethodOfAnyImplementedInInterfaceImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -2151,6 +2151,11 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
val conflictingDeclarations: List<KtSymbol>
}
interface ExpectAndActualInTheSameModule : KtFirDiagnostic<KtNamedDeclaration> {
override val diagnosticClass get() = ExpectAndActualInTheSameModule::class
val declaration: KtSymbol
}
interface MethodOfAnyImplementedInInterface : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = MethodOfAnyImplementedInInterface::class
}
@@ -2577,6 +2577,12 @@ internal class PackageOrClassifierRedeclarationImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtNamedDeclaration>(firDiagnostic, token), KtFirDiagnostic.PackageOrClassifierRedeclaration
internal class ExpectAndActualInTheSameModuleImpl(
override val declaration: KtSymbol,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtNamedDeclaration>(firDiagnostic, token), KtFirDiagnostic.ExpectAndActualInTheSameModule
internal class MethodOfAnyImplementedInInterfaceImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
@@ -24854,6 +24854,24 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualClassesAreInBeta_suppressWarningWithLv.kt");
}
@Test
@TestMetadata("expectActualInTheSameModule.kt")
public void testExpectActualInTheSameModule() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualInTheSameModule.kt");
}
@Test
@TestMetadata("expectActualInTheSameModuleDifferentFiles.kt")
public void testExpectActualInTheSameModuleDifferentFiles() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualInTheSameModuleDifferentFiles.kt");
}
@Test
@TestMetadata("expectActualMainInTheSameModuleDifferentFiles.kt")
public void testExpectActualMainInTheSameModuleDifferentFiles() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualMainInTheSameModuleDifferentFiles.kt");
}
@Test
@TestMetadata("expectDataObject.kt")
public void testExpectDataObject() throws Exception {
@@ -24854,6 +24854,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualClassesAreInBeta_suppressWarningWithLv.kt");
}
@Test
@TestMetadata("expectActualInTheSameModule.kt")
public void testExpectActualInTheSameModule() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualInTheSameModule.kt");
}
@Test
@TestMetadata("expectActualInTheSameModuleDifferentFiles.kt")
public void testExpectActualInTheSameModuleDifferentFiles() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualInTheSameModuleDifferentFiles.kt");
}
@Test
@TestMetadata("expectActualMainInTheSameModuleDifferentFiles.kt")
public void testExpectActualMainInTheSameModuleDifferentFiles() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualMainInTheSameModuleDifferentFiles.kt");
}
@Test
@TestMetadata("expectDataObject.kt")
public void testExpectDataObject() throws Exception {