JVM IR: workaround indirect dependency between lowerings

#KT-51353 Fixed
This commit is contained in:
Alexander Udalov
2022-02-18 02:27:03 +01:00
parent 3b3734f0bb
commit e5e5970883
6 changed files with 45 additions and 1 deletions
@@ -21163,6 +21163,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/kt51254.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
}
@Test
@TestMetadata("kt51353.kt")
public void testKt51353() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
}
@Test
@TestMetadata("mangledDefaultParameterFunction.kt")
public void testMangledDefaultParameterFunction() throws Exception {
@@ -290,7 +290,11 @@ class MemoizedInlineClassReplacements(
parent = propertySymbol.owner.parent
copyAttributes(propertySymbol.owner)
annotations = propertySymbol.owner.annotations
backingField = propertySymbol.owner.backingField
// In case this property is declared in an object in another file which is not yet lowered, its backing field will
// be made static later. We have to handle it here though, because this new property will be saved to the cache
// and reused when lowering the same call in all subsequent files, which would be incorrect if it was unlowered.
backingField = context.cachedDeclarations.getStaticBackingField(propertySymbol.owner)
?: propertySymbol.owner.backingField
}
}
correspondingPropertySymbol = property.symbol
+17
View File
@@ -0,0 +1,17 @@
// TARGET_BACKEND: JVM
// WITH_STDLIB
// FILE: 1.kt
val referenceFromOtherFile = O.A
// FILE: 2.kt
@JvmInline
value class Z(val value: String)
object O {
val A = Z("OK")
val B = A
}
fun box(): String = O.B.value
@@ -20725,6 +20725,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/kt51254.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
}
@Test
@TestMetadata("kt51353.kt")
public void testKt51353() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
}
@Test
@TestMetadata("mangledDefaultParameterFunction.kt")
public void testMangledDefaultParameterFunction() throws Exception {
@@ -21163,6 +21163,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inlineClasses/kt51254.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
}
@Test
@TestMetadata("kt51353.kt")
public void testKt51353() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
}
@Test
@TestMetadata("mangledDefaultParameterFunction.kt")
public void testMangledDefaultParameterFunction() throws Exception {
@@ -17315,6 +17315,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inlineClasses/kt51157.kt");
}
@TestMetadata("kt51353.kt")
public void testKt51353() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
}
@TestMetadata("mangledDefaultParameterFunction.kt")
public void testMangledDefaultParameterFunction() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());