[FIR2IR] Allow symbolTable cache lookups for generated Any methods

^KT-61972 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-09-15 16:06:29 +03:00
committed by Space Team
parent afbfc9ce8e
commit 9a6c6a40a9
20 changed files with 124 additions and 4 deletions
@@ -1052,6 +1052,12 @@ class Fir2IrDeclarationStorage(
*/
cache[declaration] = cachedInSymbolTable
}
declaration.origin.generatedAnyMethod -> {
/*
* Generated methods from Any for data and value classes are session-dependant
*/
cache[declaration] = cachedInSymbolTable
}
else -> {
error("IR declaration with signature \"$signature\" found in SymbolTable and not found in declaration storage")
}
@@ -34038,6 +34038,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Test
@TestMetadata("javaMethodWithTypeParameter.kt")
public void testJavaMethodWithTypeParameter() throws Exception {
@@ -34038,6 +34038,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Test
@TestMetadata("javaMethodWithTypeParameter.kt")
public void testJavaMethodWithTypeParameter() throws Exception {
@@ -34038,6 +34038,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Test
@TestMetadata("javaMethodWithTypeParameter.kt")
public void testJavaMethodWithTypeParameter() throws Exception {
@@ -12,7 +12,8 @@ sealed class FirDeclarationOrigin(
private val displayName: String? = null,
val fromSupertypes: Boolean = false,
val generated: Boolean = false,
val fromSource: Boolean = false
val fromSource: Boolean = false,
val generatedAnyMethod: Boolean = false,
) {
object Source : FirDeclarationOrigin(fromSource = true)
object Library : FirDeclarationOrigin()
@@ -23,9 +24,9 @@ sealed class FirDeclarationOrigin(
object Library : Java("Java(Library)")
}
sealed class Synthetic : FirDeclarationOrigin() {
object DataClassMember : Synthetic()
object ValueClassMember : Synthetic()
sealed class Synthetic(generatedAnyMethod: Boolean = false) : FirDeclarationOrigin(generatedAnyMethod = generatedAnyMethod) {
object DataClassMember : Synthetic(generatedAnyMethod = true)
object ValueClassMember : Synthetic(generatedAnyMethod = true)
object JavaProperty : Synthetic()
object DelegateField : Synthetic()
object PluginFile : Synthetic()
@@ -0,0 +1,12 @@
// LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-61972
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, WASM, NATIVE
// MODULE: common
// FILE: common.kt
data class CommonData(val value: String)
// MODULE: main()()(common)
// FILE: test.kt
data class PlatformData(val commonData: CommonData)
fun box() = "OK"
@@ -32346,6 +32346,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -34038,6 +34038,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Test
@TestMetadata("javaMethodWithTypeParameter.kt")
public void testJavaMethodWithTypeParameter() throws Exception {
@@ -34038,6 +34038,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Test
@TestMetadata("javaMethodWithTypeParameter.kt")
public void testJavaMethodWithTypeParameter() throws Exception {
@@ -29006,6 +29006,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@TestMetadata("javaMethodWithTypeParameter.kt")
public void testJavaMethodWithTypeParameter() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/javaMethodWithTypeParameter.kt");
@@ -23802,6 +23802,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -23802,6 +23802,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -23802,6 +23802,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -23802,6 +23802,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -26771,6 +26771,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -27387,6 +27387,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -26464,6 +26464,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -26772,6 +26772,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -23550,6 +23550,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -23550,6 +23550,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/multiplatform/k2/anonymousObjectAndSpecificImplementationInDeserializedIr.kt");
}
@Test
@TestMetadata("dataClassInCommonAndPlatform.kt")
public void testDataClassInCommonAndPlatform() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/dataClassInCommonAndPlatform.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/k2/annotations")
@TestDataPath("$PROJECT_ROOT")