JVM_IR KT-45408 rewrite static calls recursively
This commit is contained in:
committed by
TeamCityServer
parent
e5f218859b
commit
f6baabd98e
+6
@@ -23422,6 +23422,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45408.kt")
|
||||
public void testKt45408() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt45408.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt9897_static.kt")
|
||||
public void testKt9897_static() throws Exception {
|
||||
|
||||
+1
@@ -150,6 +150,7 @@ private class MakeCallsStatic(val context: JvmBackendContext) : IrElementTransfo
|
||||
override fun visitMemberAccess(expression: IrMemberAccessExpression<*>): IrExpression {
|
||||
val callee = expression.symbol.owner
|
||||
if (callee is IrDeclaration && callee.isJvmStaticInObject() && expression.dispatchReceiver != null) {
|
||||
expression.transformChildrenVoid()
|
||||
return context.createIrBuilder(expression.symbol, expression.startOffset, expression.endOffset).irBlock(expression) {
|
||||
// OldReceiver has to be evaluated for its side effects.
|
||||
val oldReceiver = super.visitExpression(expression.dispatchReceiver!!)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box() = X.tag().d()
|
||||
|
||||
object X {
|
||||
@JvmStatic
|
||||
fun d(): String = "OK"
|
||||
|
||||
@JvmStatic
|
||||
fun tag(): X = this
|
||||
}
|
||||
+6
@@ -23422,6 +23422,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45408.kt")
|
||||
public void testKt45408() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt45408.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt9897_static.kt")
|
||||
public void testKt9897_static() throws Exception {
|
||||
|
||||
+6
@@ -23422,6 +23422,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45408.kt")
|
||||
public void testKt45408() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt45408.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt9897_static.kt")
|
||||
public void testKt9897_static() throws Exception {
|
||||
|
||||
+5
@@ -19779,6 +19779,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt35716.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45408.kt")
|
||||
public void testKt45408() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt45408.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt9897_static.kt")
|
||||
public void testKt9897_static() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmStatic/kt9897_static.kt");
|
||||
|
||||
Reference in New Issue
Block a user