Support bound callable reference inlining in IR

This commit is contained in:
Mikhael Bogdanov
2019-05-28 15:44:51 +02:00
parent 3c093f321d
commit 81e6416bfe
28 changed files with 461 additions and 180 deletions
@@ -188,7 +188,7 @@ internal fun Type.boxReceiverForBoundReference() =
internal fun Type.boxReceiverForBoundReference(kotlinType: KotlinType, typeMapper: KotlinTypeMapper) =
AsmUtil.boxType(this, kotlinType, typeMapper)
abstract class ExpressionLambda(protected val typeMapper: KotlinTypeMapper, isCrossInline: Boolean) : LambdaInfo(isCrossInline) {
abstract class ExpressionLambda(isCrossInline: Boolean) : LambdaInfo(isCrossInline) {
override fun generateLambdaBody(sourceCompiler: SourceCompilerForInline, reifiedTypeInliner: ReifiedTypeInliner) {
node = sourceCompiler.generateLambdaBody(this)
}
@@ -200,7 +200,7 @@ class PsiExpressionLambda(
languageVersionSettings: LanguageVersionSettings,
isCrossInline: Boolean,
override val isBoundCallableReference: Boolean
) : ExpressionLambda(typeMapper, isCrossInline) {
) : ExpressionLambda(isCrossInline) {
override val lambdaClassType: Type
@@ -8,13 +8,15 @@ package org.jetbrains.kotlin.backend.jvm.codegen
import org.jetbrains.kotlin.backend.common.ir.isInlineParameter
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.BOUND_REFERENCE_RECEIVER
import org.jetbrains.kotlin.codegen.inline.*
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.getArguments
import org.jetbrains.kotlin.utils.keysToMap
import org.jetbrains.org.objectweb.asm.Type
@@ -53,7 +55,15 @@ class IrInlineCodegen(
if (irValueParameter?.isInlineParameter() == true && isInlineIrExpression(argumentExpression)) {
val irReference: IrFunctionReference =
(argumentExpression as IrBlock).statements.filterIsInstance<IrFunctionReference>().single()
rememberClosure(irReference, parameterType, irValueParameter) as IrExpressionLambdaImpl
val boundReceiver = argumentExpression.statements.filterIsInstance<IrVariable>().singleOrNull()
val lambdaInfo =
rememberClosure(irReference, parameterType, irValueParameter, boundReceiver) as IrExpressionLambdaImpl
if (boundReceiver != null) {
activeLambda = lambdaInfo
putCapturedValueOnStack(boundReceiver.initializer!!, lambdaInfo.capturedParamsInDesc.single(), 0)
activeLambda = null
}
} else {
putValueOnStack(argumentExpression, parameterType, irValueParameter?.index ?: -1, blockInfo)
}
@@ -103,11 +113,15 @@ class IrInlineCodegen(
}
}
private fun rememberClosure(irReference: IrFunctionReference, type: Type, parameter: IrValueParameter): LambdaInfo {
//assert(InlineUtil.isInlinableParameterExpression(ktLambda)) { "Couldn't find inline expression in ${expression.text}" }
val expression = irReference.symbol.owner
private fun rememberClosure(
irReference: IrFunctionReference,
type: Type,
parameter: IrValueParameter,
boundReceiver: IrVariable?
): LambdaInfo {
val referencedFunction = irReference.symbol.owner
return IrExpressionLambdaImpl(
irReference, expression, typeMapper, parameter.isCrossinline, false/*TODO*/,
irReference, referencedFunction, codegen.typeMapper, parameter.isCrossinline, boundReceiver != null,
parameter.type.isExtensionFunctionType
).also { lambda ->
val closureInfo = invocationParamBuilder.addNextValueParameter(type, true, null, parameter.index)
@@ -120,27 +134,36 @@ class IrInlineCodegen(
class IrExpressionLambdaImpl(
val reference: IrFunctionReference,
val function: IrFunction,
typeMapper: KotlinTypeMapper,
private val typeMapper: IrTypeMapper,
isCrossInline: Boolean,
override val isBoundCallableReference: Boolean,
override val isExtensionLambda: Boolean
) : ExpressionLambda(typeMapper, isCrossInline), IrExpressionLambda {
) : ExpressionLambda(isCrossInline), IrExpressionLambda {
override fun isReturnFromMe(labelName: String): Boolean {
return false //always false
}
override val lambdaClassType: Type = Type.getObjectType("test123")
companion object {
private var counter: Int = 123//TODO: pass proper type
}
override val lambdaClassType: Type = Type.getObjectType("test${counter++}")
override val capturedVars: List<CapturedParamDesc> =
arrayListOf<CapturedParamDesc>().apply {
reference.getArguments().forEachIndexed { _, (_, ir) ->
val getValue = ir as? IrGetValue ?: error("Unrecognized expression: $ir")
add(capturedParamDesc(getValue.descriptor.name.asString(), typeMapper.mapType(getValue.descriptor.type)))
add(
when (ir) {
is IrGetValue -> capturedParamDesc(ir.descriptor.name.asString(), typeMapper.mapType(ir.type))
is IrConst<*> -> capturedParamDesc(BOUND_REFERENCE_RECEIVER, typeMapper.mapType(ir.type))
else -> error("Unrecognized expression: ${ir.dump()}")
}
)
}
}
private val loweredMethod = typeMapper.mapAsmMethod(function.descriptor)
private val loweredMethod = typeMapper.mapAsmMethod(function)
val capturedParamsInDesc: List<Type> =
loweredMethod.argumentTypes.drop(if (isExtensionLambda) 1 else 0).take(capturedVars.size)
@@ -164,8 +187,11 @@ class IrExpressionLambdaImpl(
fun isInlineIrExpression(argumentExpression: IrExpression) =
when (argumentExpression) {
is IrBlock -> (argumentExpression.origin == IrStatementOrigin.LAMBDA || argumentExpression.origin == IrStatementOrigin.ANONYMOUS_FUNCTION)
//TODO: support bound CR
is IrCallableReference -> argumentExpression.dispatchReceiver == null && argumentExpression.extensionReceiver == null
is IrCallableReference -> true.also {
assert((0 until argumentExpression.valueArgumentsCount).count { argumentExpression.getValueArgument(it) != null } == 0) {
"Expecting 0 value arguments for bounded callable reference: ${argumentExpression.dump()}"
}
}
else -> false
}
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.jvm.lower
import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
import org.jetbrains.kotlin.backend.common.ScopeWithIr
import org.jetbrains.kotlin.backend.common.ir.copyTo
import org.jetbrains.kotlin.backend.common.ir.copyTypeParametersFrom
import org.jetbrains.kotlin.backend.common.ir.copyValueParametersToStatic
import org.jetbrains.kotlin.backend.common.ir.isInlineParameter
@@ -18,6 +19,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.codegen.isInlineFunctionCall
import org.jetbrains.kotlin.backend.jvm.codegen.isInlineIrExpression
import org.jetbrains.kotlin.codegen.AsmUtil.BOUND_REFERENCE_RECEIVER
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
@@ -25,6 +27,7 @@ import org.jetbrains.kotlin.ir.builders.declarations.buildFun
import org.jetbrains.kotlin.ir.declarations.IrConstructor
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionReferenceImpl
import org.jetbrains.kotlin.ir.util.defaultType
@@ -81,8 +84,13 @@ internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendConte
//..else use field itself
val irBuilder =
context.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset)
val boundReceiver = expression.dispatchReceiver ?: expression.extensionReceiver
return irBuilder.irBlock(expression, IrStatementOrigin.LAMBDA) {
lateinit var variableForBoundReceiver: IrVariable
if (boundReceiver != null) {
variableForBoundReceiver = createTmpVariable(boundReceiver, BOUND_REFERENCE_RECEIVER)
}
val newLambda = buildFun {
setSourceRange(expression)
origin = JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL
@@ -93,8 +101,11 @@ internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendConte
}.apply {
val receiver =
if (field.isStatic) null
else addValueParameter("receiver", field.parentAsClass.defaultType)
when {
field.isStatic -> null
boundReceiver != null -> variableForBoundReceiver
else -> addValueParameter("receiver", field.parentAsClass.defaultType)
}
val lambdaBodyBuilder = this@InlineCallableReferenceToLambdaPhase.context.createIrBuilder(this.symbol)
body = lambdaBodyBuilder.irBlockBody(startOffset, endOffset) {
@@ -130,7 +141,13 @@ internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendConte
val irBuilder =
context.createIrBuilder(scope.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset)
val boundReceiver = expression.dispatchReceiver ?: expression.extensionReceiver
return irBuilder.irBlock(expression, IrStatementOrigin.LAMBDA) {
lateinit var variableForBoundReceiver: IrVariable
if (boundReceiver != null) {
variableForBoundReceiver = createTmpVariable(boundReceiver, BOUND_REFERENCE_RECEIVER)
}
val newLambda = buildFun {
setSourceRange(expression)
origin = JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL
@@ -143,23 +160,42 @@ internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendConte
copyTypeParametersFrom(referencedFunction.parentAsClass)
}
copyTypeParametersFrom(referencedFunction)
copyValueParametersToStatic(referencedFunction, origin)
if (boundReceiver == null) {
copyValueParametersToStatic(referencedFunction, origin)
} else {
for (oldValueParameter in referencedFunction.valueParameters) {
valueParameters.add(
oldValueParameter.copyTo(
this,
origin = origin,
index = oldValueParameter.index
)
)
}
}
val lambdaBodyBuilder = this@InlineCallableReferenceToLambdaPhase.context.createIrBuilder(this.symbol)
body = lambdaBodyBuilder.irBlockBody(startOffset, endOffset) {
var shift = 0
+irReturn(
irCall(referencedFunction.symbol).also { call ->
val irCall =
if (expression is IrPropertyReference)
irGet(referencedFunction.returnType, null, referencedFunction.symbol)
else irCall(referencedFunction.symbol)
+irReturn(
irCall.also { call ->
for (it in this@apply.typeParameters) {
call.putTypeArgument(it.index, expression.getTypeArgument(it.index))
}
referencedFunction.dispatchReceiverParameter?.let {
call.dispatchReceiver = irGet(valueParameters[shift++])
call.dispatchReceiver =
irGet(if (expression.dispatchReceiver != null) variableForBoundReceiver else valueParameters[shift++])
}
referencedFunction.extensionReceiverParameter?.let {
call.extensionReceiver = irGet(valueParameters[shift++])
call.extensionReceiver =
irGet(if (expression.extensionReceiver != null) variableForBoundReceiver else valueParameters[shift++])
}
for (it in referencedFunction.valueParameters.indices) {
call.putValueArgument(it, irGet(valueParameters[shift++]))
}
@@ -1,5 +0,0 @@
inline fun foo(x: () -> String) = x()
fun String.id() = this
fun box() = foo("OK"::id)
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// FILE: JClass.java
public class JClass {
public String field;
public JClass(String field){
this.field = field;
}
}
// FILE: main.kt
inline fun call(s: () -> String): String {
return s()
}
fun box(): String {
return call(JClass("OK")::field)
}
@@ -1,3 +1,7 @@
// IGNORE_BACKEND: JVM
// FILE: 1.kt
package test
class X {
val result: String
inline get() = "OK"
@@ -9,6 +13,10 @@ class X {
inline fun go(f: () -> String): String = f()
// FILE: 2.kt
import test.*
fun box(): String {
return X().x()
}
@@ -0,0 +1,21 @@
// FILE: 1.kt
package test
class X {
val result: String
get() = "OK"
fun x(): String {
return go(::result)
}
}
inline fun go(f: () -> String): String = f()
// FILE: 2.kt
import test.*
fun box(): String {
return X().x()
}
@@ -0,0 +1,18 @@
// FILE: 1.kt
package test
class Foo<T> {
inner class Inner<P>(val a: T, val b: P)
}
inline fun <A, B> foo(a: A, b: B, x: (A, B) -> Foo<A>.Inner<B>): Foo<A>.Inner<B> = x(a, b)
// FILE: 2.kt
import test.*
fun box(): String {
val z = Foo<String>()
val foo = foo("O", "K", z::Inner)
return foo.a + foo.b
}
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: 1.kt
package test
class Foo(@JvmField val a: String)
inline fun test(s: () -> String): String {
return s()
}
// FILE: 2.kt
import test.*
fun box(): String {
return test(Foo("OK")::a)
}
@@ -0,0 +1,31 @@
// IGNORE_BACKEND: JS_IR
// FILE: 1.kt
package test
class Foo(val a: String) {
fun test() = a
}
inline fun test(a: String, b: () -> String, c: () -> String, d: String): String {
return a + b() + c() + d
}
// FILE: 2.kt
import test.*
var effects = ""
fun create(a: String): Foo {
effects += a
return Foo(a)
}
fun box(): String {
val result = test(create("A").a, create("B")::a, create("C")::test, create("D").a)
if (result != effects) return "fail 1: $effects != $result"
return if (result == "ABCD") "OK" else "fail 2: $result"
}
@@ -1,8 +1,6 @@
// FILE: 1.kt
package test
inline fun foo(x: () -> String, z: String) = x() + z
inline fun foo(x: () -> String) = x()
fun String.id() = this
@@ -10,8 +8,4 @@ fun String.id() = this
import test.*
fun box() : String {
var zeroSlot = "fail";
val z = "O"
return foo(z::id, "K")
}
fun box() = foo("OK"::id)
@@ -1,7 +1,15 @@
// FILE: 1.kt
package test
inline fun go(f: () -> String) = f()
fun String.id(): String = this
// FILE: 2.kt
import test.*
fun box(): String {
val x = "OK"
return go(x::id)
@@ -0,0 +1,17 @@
// FILE: 1.kt
package test
inline fun foo(x: () -> String, z: String) = x() + z
fun String.id() = this
// FILE: 2.kt
import test.*
fun box() : String {
var zeroSlot = "fail";
val z = "O"
return foo(z::id, "K")
}
@@ -0,0 +1,19 @@
// !LANGUAGE: +NewInference
// FILE: 1.kt
package test
class Foo<T> {
inner class Inner<P>(val a: T, val b: P)
}
inline fun <A, B> foo(a: A, b: B, foo: Foo<A>, x: (Foo<A>, A, B) -> Foo<A>.Inner<B>): Foo<A>.Inner<B> = x(foo, a, b)
// FILE: 2.kt
import test.*
fun box(): String {
val foo = foo<String, String>("O", "K", Foo<String>(), Foo<String>::Inner)
return foo.a + foo.b
}
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: 1.kt
package test
class Foo(@JvmField val a: String)
inline fun test(s: (Foo) -> String): String {
return s(Foo("OK"))
}
// FILE: 2.kt
import test.*
fun box(): String {
return test(Foo::a)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// FILE: JClass.java
public class JClass {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun box(): String {
return if (call(10, A()::calc) == 5) "OK" else "fail"
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun box(): String {
return if (call(A(10)::calc) == 5) "OK" else "fail"
}
@@ -1869,6 +1869,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
}
@TestMetadata("javaField.kt")
public void testJavaField() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/javaField.kt");
}
@TestMetadata("kCallableNameIntrinsic.kt")
public void testKCallableNameIntrinsic() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
@@ -1961,34 +1966,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/callableReference/bound/equals/reflectionReference.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/inline")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inline extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInInline() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound/inline"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/function")
@@ -734,11 +734,21 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/intrinsic.kt");
}
@TestMetadata("jvmFieldProperty.kt")
public void testJvmFieldProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt");
}
@TestMetadata("kt15449.kt")
public void testKt15449() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
@@ -801,6 +811,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt");
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/expression.kt");
@@ -816,11 +831,21 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/callableReference/bound/filter.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/intrinsic.kt");
}
@TestMetadata("jvmFieldProperty.kt")
public void testJvmFieldProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt");
}
@TestMetadata("kt18728.kt")
public void testKt18728() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/kt18728.kt");
@@ -861,11 +886,26 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt");
}
@TestMetadata("sideEffect.kt")
public void testSideEffect() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt");
}
@TestMetadata("simpleVal2.kt")
public void testSimpleVal2() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt");
}
@TestMetadata("topLevelExtensionProperty.kt")
public void testTopLevelExtensionProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt");
@@ -734,11 +734,21 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/intrinsic.kt");
}
@TestMetadata("jvmFieldProperty.kt")
public void testJvmFieldProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt");
}
@TestMetadata("kt15449.kt")
public void testKt15449() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
@@ -801,6 +811,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt");
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/expression.kt");
@@ -816,11 +831,21 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/callableReference/bound/filter.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/intrinsic.kt");
}
@TestMetadata("jvmFieldProperty.kt")
public void testJvmFieldProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt");
}
@TestMetadata("kt18728.kt")
public void testKt18728() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/kt18728.kt");
@@ -861,11 +886,26 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt");
}
@TestMetadata("sideEffect.kt")
public void testSideEffect() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt");
}
@TestMetadata("simpleVal2.kt")
public void testSimpleVal2() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt");
}
@TestMetadata("topLevelExtensionProperty.kt")
public void testTopLevelExtensionProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt");
@@ -1869,6 +1869,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
}
@TestMetadata("javaField.kt")
public void testJavaField() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/javaField.kt");
}
@TestMetadata("kCallableNameIntrinsic.kt")
public void testKCallableNameIntrinsic() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
@@ -1961,34 +1966,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/callableReference/bound/equals/reflectionReference.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/inline")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inline extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInInline() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound/inline"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/function")
@@ -1869,6 +1869,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
}
@TestMetadata("javaField.kt")
public void testJavaField() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/javaField.kt");
}
@TestMetadata("kCallableNameIntrinsic.kt")
public void testKCallableNameIntrinsic() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
@@ -1961,34 +1966,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/callableReference/bound/equals/reflectionReference.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/inline")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inline extends AbstractIrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInInline() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound/inline"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/function")
@@ -734,11 +734,21 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/intrinsic.kt");
}
@TestMetadata("jvmFieldProperty.kt")
public void testJvmFieldProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt");
}
@TestMetadata("kt15449.kt")
public void testKt15449() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
@@ -801,6 +811,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt");
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/expression.kt");
@@ -816,11 +831,21 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/callableReference/bound/filter.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/intrinsic.kt");
}
@TestMetadata("jvmFieldProperty.kt")
public void testJvmFieldProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt");
}
@TestMetadata("kt18728.kt")
public void testKt18728() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/kt18728.kt");
@@ -861,11 +886,26 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt");
}
@TestMetadata("sideEffect.kt")
public void testSideEffect() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt");
}
@TestMetadata("simpleVal2.kt")
public void testSimpleVal2() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt");
}
@TestMetadata("topLevelExtensionProperty.kt")
public void testTopLevelExtensionProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt");
@@ -44,6 +44,11 @@ public class IrCallableReferenceInlineTestsGenerated extends AbstractIrCallableR
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/intrinsic.kt");
@@ -111,6 +116,11 @@ public class IrCallableReferenceInlineTestsGenerated extends AbstractIrCallableR
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt");
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/expression.kt");
@@ -126,6 +136,11 @@ public class IrCallableReferenceInlineTestsGenerated extends AbstractIrCallableR
runTest("compiler/testData/codegen/boxInline/callableReference/bound/filter.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/intrinsic.kt");
@@ -171,11 +186,26 @@ public class IrCallableReferenceInlineTestsGenerated extends AbstractIrCallableR
runTest("compiler/testData/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt");
}
@TestMetadata("sideEffect.kt")
public void testSideEffect() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt");
}
@TestMetadata("simpleVal2.kt")
public void testSimpleVal2() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt");
}
@TestMetadata("topLevelExtensionProperty.kt")
public void testTopLevelExtensionProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt");
@@ -1486,34 +1486,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/bound/equals/reflectionReference.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/inline")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inline extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInInline() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound/inline"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/function")
@@ -44,6 +44,11 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
runTest("compiler/testData/codegen/boxInline/callableReference/constructor.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/intrinsic.kt");
@@ -111,6 +116,11 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt");
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/expression.kt");
@@ -126,6 +136,11 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
runTest("compiler/testData/codegen/boxInline/callableReference/bound/filter.kt");
}
@TestMetadata("innerGenericConstuctor.kt")
public void testInnerGenericConstuctor() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt");
}
@TestMetadata("intrinsic.kt")
public void testIntrinsic() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/intrinsic.kt");
@@ -171,11 +186,26 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
runTest("compiler/testData/codegen/boxInline/callableReference/bound/propertyImportedFromObject.kt");
}
@TestMetadata("sideEffect.kt")
public void testSideEffect() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt");
}
@TestMetadata("simpleVal2.kt")
public void testSimpleVal2() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt");
}
@TestMetadata("topLevelExtensionProperty.kt")
public void testTopLevelExtensionProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/callableReference/bound/topLevelExtensionProperty.kt");
@@ -1486,34 +1486,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/bound/equals/reflectionReference.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/inline")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Inline extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInInline() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound/inline"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("emptyLhsProperty.kt")
public void testEmptyLhsProperty() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simple.kt");
}
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/callableReference/function")