[FIR2IR] Consider property init value from nested class, ^KT-52057 Fixed
This commit is contained in:
+8
-2
@@ -76,6 +76,12 @@ fun deserializeClassToSymbol(
|
||||
containerSource,
|
||||
symbol,
|
||||
annotationDeserializer,
|
||||
if (status.isCompanion) {
|
||||
parentContext.constDeserializer
|
||||
} else {
|
||||
((containerSource as? KotlinJvmBinarySourceElement)?.binaryClass)?.let { FirConstDeserializer(session, it) }
|
||||
?: parentContext.constDeserializer
|
||||
},
|
||||
status.isInner
|
||||
) ?: FirDeserializationContext.createForClass(
|
||||
classId,
|
||||
@@ -203,9 +209,9 @@ fun deserializeClassToSymbol(
|
||||
}
|
||||
it.setSealedClassInheritors(inheritors)
|
||||
}
|
||||
|
||||
|
||||
it.valueClassRepresentation = computeValueClassRepresentation(it, session)
|
||||
|
||||
|
||||
(it.annotations as MutableList<FirAnnotation>) +=
|
||||
context.annotationDeserializer.loadClassAnnotations(classProto, context.nameResolver)
|
||||
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ class FirDeserializationContext(
|
||||
containerSource: DeserializedContainerSource? = this.containerSource,
|
||||
outerClassSymbol: FirRegularClassSymbol? = this.outerClassSymbol,
|
||||
annotationDeserializer: AbstractAnnotationDeserializer = this.annotationDeserializer,
|
||||
constDeserializer: FirConstDeserializer = this.constDeserializer,
|
||||
capturesTypeParameters: Boolean = true,
|
||||
containingDeclarationSymbol: FirBasedSymbol<*>? = this.outerClassSymbol
|
||||
): FirDeserializationContext = FirDeserializationContext(
|
||||
|
||||
+6
@@ -25251,6 +25251,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// ISSUE: KT-52057
|
||||
// MODULE: lib
|
||||
// FILE: Class.kt
|
||||
|
||||
annotation class Ann(val p: String)
|
||||
|
||||
class Class {
|
||||
object Obj {
|
||||
const val Const = "const"
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import Class
|
||||
|
||||
@Ann("${Class.Obj.Const}+")
|
||||
fun f(): String = "OK"
|
||||
|
||||
fun box() = f()
|
||||
+6
@@ -24771,6 +24771,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
|
||||
+6
@@ -25251,6 +25251,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
|
||||
+5
@@ -20808,6 +20808,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/createNestedClass.kt");
|
||||
|
||||
+6
@@ -19901,6 +19901,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
|
||||
+6
@@ -19865,6 +19865,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
|
||||
+5
@@ -17591,6 +17591,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/createNestedClass.kt");
|
||||
|
||||
+6
@@ -22522,6 +22522,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/innerNested"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("considerPropertyInitValueFromNestedClass.kt")
|
||||
public void testConsiderPropertyInitValueFromNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/considerPropertyInitValueFromNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("createNestedClass.kt")
|
||||
public void testCreateNestedClass() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user