[Common IR] Do inlining of callable references of inline functions
^KT-52805 Fixed
This commit is contained in:
committed by
Space
parent
3424e756ad
commit
bb8da65188
+6
@@ -1060,6 +1060,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends A
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+1
-1
@@ -395,7 +395,7 @@ class FunctionInlining(
|
||||
for (index in 0 until irFunctionReference.typeArgumentsCount)
|
||||
putTypeArgument(index, irFunctionReference.getTypeArgument(index))
|
||||
}.implicitCastIfNeededTo(irCall.type)
|
||||
return this@FunctionInlining.visitExpression(super.visitExpression(immediateCall))
|
||||
return super.visitExpression(immediateCall).transform(this@FunctionInlining, null)
|
||||
}
|
||||
|
||||
override fun visitElement(element: IrElement) = element.accept(this, null)
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
package utils
|
||||
|
||||
inline public fun <T> composition(x0: T, x1: T, x2: T, fn: (T, T) -> T): T = fn(fn(x0, x1), x2)
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import utils.*
|
||||
|
||||
public fun nonInlinableConcat(x: String, y: String): String = "$x$y"
|
||||
|
||||
inline fun appendTo(target: String, suffix: String): String = nonInlinableConcat(target, suffix)
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: test except=nonInlinableConcat
|
||||
internal fun test(x: String): String = composition("", "O", "K", ::appendTo)
|
||||
|
||||
fun box(): String {
|
||||
return test("O")
|
||||
}
|
||||
+6
@@ -1060,6 +1060,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
+6
@@ -1060,6 +1060,12 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineCallableReference.kt")
|
||||
public void testInlineCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/inlineCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerGenericConstuctor.kt")
|
||||
public void testInnerGenericConstuctor() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user