From 81e6416bfee26298ade26c105eaf84d04e923c71 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Tue, 28 May 2019 15:44:51 +0200 Subject: [PATCH] Support bound callable reference inlining in IR --- .../kotlin/codegen/inline/LambdaInfo.kt | 4 +- .../backend/jvm/codegen/IrInlineCodegen.kt | 54 ++++++++++++++----- .../lower/InlineCallableRefereceToLambda.kt | 52 +++++++++++++++--- .../callableReference/bound/inline/simple.kt | 5 -- .../box/callableReference/bound/javaField.kt | 18 +++++++ .../bound/emptyLhsOnInlineProperty.kt} | 8 +++ .../bound/emptyLhsProperty.kt | 21 ++++++++ .../bound/innerGenericConstuctor.kt | 18 +++++++ .../bound/jvmFieldProperty.kt | 19 +++++++ .../callableReference/bound/sideEffect.kt | 31 +++++++++++ .../callableReference/bound/simple.kt | 10 +--- .../callableReference/bound}/simpleVal.kt | 8 +++ .../callableReference/bound/simpleVal2.kt | 17 ++++++ .../innerGenericConstuctor.kt | 19 +++++++ .../callableReference/jvmFieldProperty.kt | 19 +++++++ .../boundFieldReferenceInInline.kt | 1 - .../boundFunReferenceInInline.kt | 1 - .../boundPropertyReferenceInInline.kt | 1 - .../codegen/BlackBoxCodegenTestGenerated.java | 33 ++---------- .../BlackBoxInlineCodegenTestGenerated.java | 40 ++++++++++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 40 ++++++++++++++ .../LightAnalysisModeTestGenerated.java | 33 ++---------- .../ir/IrBlackBoxCodegenTestGenerated.java | 33 ++---------- .../IrBlackBoxInlineCodegenTestGenerated.java | 40 ++++++++++++++ ...CallableReferenceInlineTestsGenerated.java | 30 +++++++++++ .../IrJsCodegenBoxTestGenerated.java | 28 ---------- ...CallableReferenceInlineTestsGenerated.java | 30 +++++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 28 ---------- 28 files changed, 461 insertions(+), 180 deletions(-) delete mode 100644 compiler/testData/codegen/box/callableReference/bound/inline/simple.kt create mode 100644 compiler/testData/codegen/box/callableReference/bound/javaField.kt rename compiler/testData/codegen/{box/callableReference/bound/inline/emptyLhsProperty.kt => boxInline/callableReference/bound/emptyLhsOnInlineProperty.kt} (71%) create mode 100644 compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt create mode 100644 compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt create mode 100644 compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt create mode 100644 compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt rename compiler/testData/codegen/{box/callableReference/bound/inline => boxInline/callableReference/bound}/simpleVal.kt (68%) create mode 100644 compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt create mode 100644 compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt create mode 100644 compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt index fc8e74ca07c..697041850d7 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt @@ -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 diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt index c09acfb171a..5a78e5957c2 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt @@ -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().single() - rememberClosure(irReference, parameterType, irValueParameter) as IrExpressionLambdaImpl + val boundReceiver = argumentExpression.statements.filterIsInstance().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 = arrayListOf().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 = 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 } diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InlineCallableRefereceToLambda.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InlineCallableRefereceToLambda.kt index 595a276b99b..9a1d47ab3e5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InlineCallableRefereceToLambda.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InlineCallableRefereceToLambda.kt @@ -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++])) } diff --git a/compiler/testData/codegen/box/callableReference/bound/inline/simple.kt b/compiler/testData/codegen/box/callableReference/bound/inline/simple.kt deleted file mode 100644 index ab672b23ac4..00000000000 --- a/compiler/testData/codegen/box/callableReference/bound/inline/simple.kt +++ /dev/null @@ -1,5 +0,0 @@ -inline fun foo(x: () -> String) = x() - -fun String.id() = this - -fun box() = foo("OK"::id) diff --git a/compiler/testData/codegen/box/callableReference/bound/javaField.kt b/compiler/testData/codegen/box/callableReference/bound/javaField.kt new file mode 100644 index 00000000000..349f5ad8f20 --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/bound/javaField.kt @@ -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) +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt b/compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsOnInlineProperty.kt similarity index 71% rename from compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt rename to compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsOnInlineProperty.kt index f745c2d4e81..16492e90db3 100644 --- a/compiler/testData/codegen/box/callableReference/bound/inline/emptyLhsProperty.kt +++ b/compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsOnInlineProperty.kt @@ -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() } diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt b/compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt new file mode 100644 index 00000000000..7e0611aff84 --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsProperty.kt @@ -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() +} diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt b/compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt new file mode 100644 index 00000000000..6602232f169 --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/bound/innerGenericConstuctor.kt @@ -0,0 +1,18 @@ +// FILE: 1.kt +package test + +class Foo { + inner class Inner

(val a: T, val b: P) +} + +inline fun foo(a: A, b: B, x: (A, B) -> Foo.Inner): Foo.Inner = x(a, b) + +// FILE: 2.kt + +import test.* + +fun box(): String { + val z = Foo() + val foo = foo("O", "K", z::Inner) + return foo.a + foo.b +} diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt b/compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt new file mode 100644 index 00000000000..c28509e7a7c --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/bound/jvmFieldProperty.kt @@ -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) +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt b/compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt new file mode 100644 index 00000000000..d9d261f18a6 --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/bound/sideEffect.kt @@ -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" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/simple.kt b/compiler/testData/codegen/boxInline/callableReference/bound/simple.kt index 6b4306c4705..bdef8ba908e 100644 --- a/compiler/testData/codegen/boxInline/callableReference/bound/simple.kt +++ b/compiler/testData/codegen/boxInline/callableReference/bound/simple.kt @@ -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) diff --git a/compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt b/compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt similarity index 68% rename from compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt rename to compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt index fea3e21c688..987318669e1 100644 --- a/compiler/testData/codegen/box/callableReference/bound/inline/simpleVal.kt +++ b/compiler/testData/codegen/boxInline/callableReference/bound/simpleVal.kt @@ -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) diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt b/compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt new file mode 100644 index 00000000000..6b4306c4705 --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/bound/simpleVal2.kt @@ -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") +} diff --git a/compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt b/compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt new file mode 100644 index 00000000000..7c9ebe1ea3f --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/innerGenericConstuctor.kt @@ -0,0 +1,19 @@ +// !LANGUAGE: +NewInference +// FILE: 1.kt +package test + +class Foo { + inner class Inner

(val a: T, val b: P) +} + +inline fun foo(a: A, b: B, foo: Foo, x: (Foo, A, B) -> Foo.Inner): Foo.Inner = x(foo, a, b) + +// FILE: 2.kt + +import test.* + +fun box(): String { + + val foo = foo("O", "K", Foo(), Foo::Inner) + return foo.a + foo.b +} diff --git a/compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt b/compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt new file mode 100644 index 00000000000..4c43597e6e8 --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/jvmFieldProperty.kt @@ -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) +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/callableReference/boundFieldReferenceInInline.kt b/compiler/testData/codegen/bytecodeText/callableReference/boundFieldReferenceInInline.kt index 36f975a536e..108e782182f 100644 --- a/compiler/testData/codegen/bytecodeText/callableReference/boundFieldReferenceInInline.kt +++ b/compiler/testData/codegen/bytecodeText/callableReference/boundFieldReferenceInInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: JClass.java public class JClass { diff --git a/compiler/testData/codegen/bytecodeText/callableReference/boundFunReferenceInInline.kt b/compiler/testData/codegen/bytecodeText/callableReference/boundFunReferenceInInline.kt index 84106abc1d1..10fa319bf43 100644 --- a/compiler/testData/codegen/bytecodeText/callableReference/boundFunReferenceInInline.kt +++ b/compiler/testData/codegen/bytecodeText/callableReference/boundFunReferenceInInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR fun box(): String { return if (call(10, A()::calc) == 5) "OK" else "fail" } diff --git a/compiler/testData/codegen/bytecodeText/callableReference/boundPropertyReferenceInInline.kt b/compiler/testData/codegen/bytecodeText/callableReference/boundPropertyReferenceInInline.kt index cdf83f9aa89..bda3ed5b852 100644 --- a/compiler/testData/codegen/bytecodeText/callableReference/boundPropertyReferenceInInline.kt +++ b/compiler/testData/codegen/bytecodeText/callableReference/boundPropertyReferenceInInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR fun box(): String { return if (call(A(10)::calc) == 5) "OK" else "fail" } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index c1f8417b024..5273d8a0796 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -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") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index d23243936ae..415e4410352 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index 0262cbfc877..46eb9da343f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index ad79dffa334..fd0a85b4531 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -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") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 1a8d49ec9e5..8ceda1e74e6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -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") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index b5875cfc3a2..ade26c955ca 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -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"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrCallableReferenceInlineTestsGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrCallableReferenceInlineTestsGenerated.java index 4cbdba3c50e..7eff737dc46 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrCallableReferenceInlineTestsGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrCallableReferenceInlineTestsGenerated.java @@ -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"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 9cb8d0897a9..d921a99d479 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -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") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/CallableReferenceInlineTestsGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/CallableReferenceInlineTestsGenerated.java index 9adf91162f4..0b91065fff0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/CallableReferenceInlineTestsGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/CallableReferenceInlineTestsGenerated.java @@ -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"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 8e69968eac9..f9a0a75cc68 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -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")