[JVM_IR] Fix check for inline class property backing in lowering.
The inline class lowering would attempt to lower a companion object property backing field. ^KT-47762 Fixed.
This commit is contained in:
committed by
Alexander Udalov
parent
46d2e52543
commit
2877f1cabe
+6
@@ -18910,6 +18910,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
|
|||||||
+4
-1
@@ -424,7 +424,10 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F
|
|||||||
override fun visitGetField(expression: IrGetField): IrExpression {
|
override fun visitGetField(expression: IrGetField): IrExpression {
|
||||||
val field = expression.symbol.owner
|
val field = expression.symbol.owner
|
||||||
val parent = field.parent
|
val parent = field.parent
|
||||||
if (parent is IrClass && parent.isInline && field.name == parent.inlineClassFieldName) {
|
if (field.origin == IrDeclarationOrigin.PROPERTY_BACKING_FIELD &&
|
||||||
|
parent is IrClass &&
|
||||||
|
parent.isInline &&
|
||||||
|
field.name == parent.inlineClassFieldName) {
|
||||||
val receiver = expression.receiver!!.transform(this, null)
|
val receiver = expression.receiver!!.transform(this, null)
|
||||||
return coerceInlineClasses(receiver, receiver.type, field.type)
|
return coerceInlineClasses(receiver, receiver.type, field.type)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
inline class A(val a: Int = 1) {
|
||||||
|
companion object {
|
||||||
|
val a: Int = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (A.a != 2) return "FAIL1"
|
||||||
|
val instance = A()
|
||||||
|
return if (instance.a != 1) "FAIL2" else "OK"
|
||||||
|
}
|
||||||
+6
@@ -18868,6 +18868,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
|
|||||||
+6
@@ -18910,6 +18910,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
|
|||||||
+5
@@ -15648,6 +15648,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47609.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -13637,6 +13637,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||||
|
|||||||
Generated
+5
@@ -13043,6 +13043,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||||
|
|||||||
Generated
+5
@@ -13108,6 +13108,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -7158,6 +7158,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47762.kt")
|
||||||
|
public void testKt47762() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt47762.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user