[FIR] Implement deprecation warning for synthetic without java base getter

Also implement new resolution behavior under language feature

^KT-63076 Fixed
^KT-64358
This commit is contained in:
Dmitriy Novozhilov
2023-12-15 17:08:53 +02:00
committed by Space Team
parent d5b0a5b220
commit fa33c5dc79
23 changed files with 384 additions and 35 deletions
@@ -5518,6 +5518,14 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirJvmErrors.SYNTHETIC_PROPERTY_WITHOUT_JAVA_ORIGIN) { firDiagnostic ->
SyntheticPropertyWithoutJavaOriginImpl(
firSymbolBuilder.functionLikeBuilder.buildFunctionSymbol(firDiagnostic.a),
firDiagnostic.b,
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirJsErrors.IMPLEMENTING_FUNCTION_INTERFACE) { firDiagnostic ->
ImplementingFunctionInterfaceImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -3839,6 +3839,12 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = NoReflectionInClassPath::class
}
interface SyntheticPropertyWithoutJavaOrigin : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = SyntheticPropertyWithoutJavaOrigin::class
val originalSymbol: KtFunctionLikeSymbol
val functionName: Name
}
interface ImplementingFunctionInterface : KtFirDiagnostic<KtClassOrObject> {
override val diagnosticClass get() = ImplementingFunctionInterface::class
}
@@ -4635,6 +4635,13 @@ internal class NoReflectionInClassPathImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.NoReflectionInClassPath
internal class SyntheticPropertyWithoutJavaOriginImpl(
override val originalSymbol: KtFunctionLikeSymbol,
override val functionName: Name,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.SyntheticPropertyWithoutJavaOrigin
internal class ImplementingFunctionInterfaceImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
@@ -22443,6 +22443,24 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt");
}
@Test
@TestMetadata("syntheticPropertyFromKotlin_k1Like.kt")
public void testSyntheticPropertyFromKotlin_k1Like() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlin_k1Like.kt");
}
@Test
@TestMetadata("syntheticPropertyFromKotlin_warning.kt")
public void testSyntheticPropertyFromKotlin_warning() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlin_warning.kt");
}
@Test
@TestMetadata("syntheticPropertyThroughJava.kt")
public void testSyntheticPropertyThroughJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyThroughJava.kt");
}
@Test
@TestMetadata("unitVsVoid.kt")
public void testUnitVsVoid() throws Exception {
@@ -22443,6 +22443,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt");
}
@Test
@TestMetadata("syntheticPropertyFromKotlin_k1Like.kt")
public void testSyntheticPropertyFromKotlin_k1Like() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlin_k1Like.kt");
}
@Test
@TestMetadata("syntheticPropertyFromKotlin_warning.kt")
public void testSyntheticPropertyFromKotlin_warning() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlin_warning.kt");
}
@Test
@TestMetadata("syntheticPropertyThroughJava.kt")
public void testSyntheticPropertyThroughJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyThroughJava.kt");
}
@Test
@TestMetadata("unitVsVoid.kt")
public void testUnitVsVoid() throws Exception {