[IR] Supported inlining of adapted references + tests
This commit is contained in:
+40
@@ -1020,6 +1020,46 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+121
-107
@@ -225,8 +225,6 @@ class FunctionInlining(
|
||||
else (copyIrElement.copy(argument) as IrExpression)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------//
|
||||
|
||||
override fun visitCall(expression: IrCall): IrExpression {
|
||||
if (!isLambdaCall(expression))
|
||||
return super.visitCall(expression)
|
||||
@@ -236,119 +234,133 @@ class FunctionInlining(
|
||||
if ((dispatchReceiver.symbol.owner as? IrValueParameter)?.isNoinline == true)
|
||||
return super.visitCall(expression)
|
||||
|
||||
if (functionArgument is IrFunctionReference) {
|
||||
functionArgument.transformChildrenVoid(this)
|
||||
|
||||
val function = functionArgument.symbol.owner
|
||||
val functionParameters = function.explicitParameters
|
||||
val boundFunctionParameters = functionArgument.getArgumentsWithIr()
|
||||
val unboundFunctionParameters = functionParameters - boundFunctionParameters.map { it.first }
|
||||
val boundFunctionParametersMap = boundFunctionParameters.associate { it.first to it.second }
|
||||
|
||||
var unboundIndex = 0
|
||||
val unboundArgsSet = unboundFunctionParameters.toSet()
|
||||
val valueParameters = expression.getArgumentsWithIr().drop(1) // Skip dispatch receiver.
|
||||
|
||||
val superType = functionArgument.type as IrSimpleType
|
||||
val superTypeArgumentsMap = expression.symbol.owner.parentAsClass.typeParameters.associate { typeParam ->
|
||||
typeParam.symbol to superType.arguments[typeParam.index].typeOrNull!!
|
||||
}
|
||||
|
||||
val immediateCall = with(expression) {
|
||||
when (function) {
|
||||
is IrConstructor -> {
|
||||
val classTypeParametersCount = function.parentAsClass.typeParameters.size
|
||||
IrConstructorCallImpl.fromSymbolOwner(
|
||||
startOffset,
|
||||
endOffset,
|
||||
function.returnType,
|
||||
function.symbol,
|
||||
classTypeParametersCount
|
||||
)
|
||||
}
|
||||
is IrSimpleFunction ->
|
||||
IrCallImpl(
|
||||
startOffset,
|
||||
endOffset,
|
||||
function.returnType,
|
||||
function.symbol,
|
||||
function.typeParameters.size,
|
||||
function.valueParameters.size
|
||||
)
|
||||
else ->
|
||||
error("Unknown function kind : ${function.render()}")
|
||||
}
|
||||
}.apply {
|
||||
for (parameter in functionParameters) {
|
||||
val argument =
|
||||
if (parameter !in unboundArgsSet) {
|
||||
val arg = boundFunctionParametersMap[parameter]!!
|
||||
if (arg is IrGetValueWithoutLocation)
|
||||
arg.withLocation(expression.startOffset, expression.endOffset)
|
||||
else arg
|
||||
} else {
|
||||
if (unboundIndex == valueParameters.size && parameter.defaultValue != null)
|
||||
copyIrElement.copy(parameter.defaultValue!!.expression) as IrExpression
|
||||
else if (!parameter.isVararg) {
|
||||
assert(unboundIndex < valueParameters.size) {
|
||||
"Attempt to use unbound parameter outside of the callee's value parameters"
|
||||
}
|
||||
valueParameters[unboundIndex++].second
|
||||
} else {
|
||||
val elements = mutableListOf<IrVarargElement>()
|
||||
while (unboundIndex < valueParameters.size) {
|
||||
val (param, value) = valueParameters[unboundIndex++]
|
||||
val substitutedParamType = param.type.substitute(superTypeArgumentsMap)
|
||||
if (substitutedParamType == parameter.varargElementType!!)
|
||||
elements += value
|
||||
else
|
||||
elements += IrSpreadElementImpl(expression.startOffset, expression.endOffset, value)
|
||||
}
|
||||
IrVarargImpl(
|
||||
expression.startOffset, expression.endOffset,
|
||||
parameter.type,
|
||||
parameter.varargElementType!!,
|
||||
elements
|
||||
)
|
||||
}
|
||||
}
|
||||
when (parameter) {
|
||||
function.dispatchReceiverParameter ->
|
||||
this.dispatchReceiver = argument.implicitCastIfNeededTo(function.dispatchReceiverParameter!!.type)
|
||||
|
||||
function.extensionReceiverParameter ->
|
||||
this.extensionReceiver = argument.implicitCastIfNeededTo(function.extensionReceiverParameter!!.type)
|
||||
|
||||
else ->
|
||||
putValueArgument(
|
||||
parameter.index,
|
||||
argument.implicitCastIfNeededTo(function.valueParameters[parameter.index].type)
|
||||
)
|
||||
}
|
||||
}
|
||||
assert(unboundIndex == valueParameters.size) { "Not all arguments of the callee are used" }
|
||||
for (index in 0 until functionArgument.typeArgumentsCount)
|
||||
putTypeArgument(index, functionArgument.getTypeArgument(index))
|
||||
}.implicitCastIfNeededTo(expression.type)
|
||||
return this@FunctionInlining.visitExpression(super.visitExpression(immediateCall))
|
||||
return when {
|
||||
functionArgument is IrFunctionReference -> inlineFunctionReference(expression, functionArgument)
|
||||
functionArgument.isAdaptedFunctionReference() -> inlineAdaptedFunctionReference(expression, functionArgument as IrBlock)
|
||||
functionArgument is IrFunctionExpression -> inlineFunctionExpression(expression, functionArgument)
|
||||
else -> super.visitCall(expression)
|
||||
}
|
||||
if (functionArgument !is IrFunctionExpression)
|
||||
return super.visitCall(expression)
|
||||
}
|
||||
|
||||
fun inlineFunctionExpression(irCall: IrCall, irFunctionExpression: IrFunctionExpression): IrExpression {
|
||||
// Inline the lambda. Lambda parameters will be substituted with lambda arguments.
|
||||
val newExpression = inlineFunction(
|
||||
expression,
|
||||
functionArgument.function,
|
||||
irCall,
|
||||
irFunctionExpression.function,
|
||||
false
|
||||
)
|
||||
// Substitute lambda arguments with target function arguments.
|
||||
return newExpression.transform(
|
||||
this,
|
||||
null
|
||||
return newExpression.transform(this, null)
|
||||
}
|
||||
|
||||
fun inlineAdaptedFunctionReference(irCall: IrCall, irBlock: IrBlock): IrExpression {
|
||||
val irFunction = irBlock.statements[0] as IrFunction
|
||||
irFunction.transformChildrenVoid(this)
|
||||
val irFunctionReference = irBlock.statements[1] as IrFunctionReference
|
||||
val inlinedFunctionReference = inlineFunctionReference(irCall, irFunctionReference)
|
||||
return IrBlockImpl(
|
||||
irCall.startOffset, irCall.endOffset,
|
||||
inlinedFunctionReference.type, origin = null,
|
||||
statements = listOf(irFunction, inlinedFunctionReference)
|
||||
)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------//
|
||||
fun inlineFunctionReference(irCall: IrCall, irFunctionReference: IrFunctionReference): IrExpression {
|
||||
irFunctionReference.transformChildrenVoid(this)
|
||||
|
||||
val function = irFunctionReference.symbol.owner
|
||||
val functionParameters = function.explicitParameters
|
||||
val boundFunctionParameters = irFunctionReference.getArgumentsWithIr()
|
||||
val unboundFunctionParameters = functionParameters - boundFunctionParameters.map { it.first }
|
||||
val boundFunctionParametersMap = boundFunctionParameters.associate { it.first to it.second }
|
||||
|
||||
var unboundIndex = 0
|
||||
val unboundArgsSet = unboundFunctionParameters.toSet()
|
||||
val valueParameters = irCall.getArgumentsWithIr().drop(1) // Skip dispatch receiver.
|
||||
|
||||
val superType = irFunctionReference.type as IrSimpleType
|
||||
val superTypeArgumentsMap = irCall.symbol.owner.parentAsClass.typeParameters.associate { typeParam ->
|
||||
typeParam.symbol to superType.arguments[typeParam.index].typeOrNull!!
|
||||
}
|
||||
|
||||
val immediateCall = with(irCall) {
|
||||
when (function) {
|
||||
is IrConstructor -> {
|
||||
val classTypeParametersCount = function.parentAsClass.typeParameters.size
|
||||
IrConstructorCallImpl.fromSymbolOwner(
|
||||
startOffset,
|
||||
endOffset,
|
||||
function.returnType,
|
||||
function.symbol,
|
||||
classTypeParametersCount
|
||||
)
|
||||
}
|
||||
is IrSimpleFunction ->
|
||||
IrCallImpl(
|
||||
startOffset,
|
||||
endOffset,
|
||||
function.returnType,
|
||||
function.symbol,
|
||||
function.typeParameters.size,
|
||||
function.valueParameters.size
|
||||
)
|
||||
else ->
|
||||
kotlin.error("Unknown function kind : ${function.render()}")
|
||||
}
|
||||
}.apply {
|
||||
for (parameter in functionParameters) {
|
||||
val argument =
|
||||
if (parameter !in unboundArgsSet) {
|
||||
val arg = boundFunctionParametersMap[parameter]!!
|
||||
if (arg is IrGetValueWithoutLocation)
|
||||
arg.withLocation(irCall.startOffset, irCall.endOffset)
|
||||
else arg
|
||||
} else {
|
||||
if (unboundIndex == valueParameters.size && parameter.defaultValue != null)
|
||||
copyIrElement.copy(parameter.defaultValue!!.expression) as IrExpression
|
||||
else if (!parameter.isVararg) {
|
||||
assert(unboundIndex < valueParameters.size) {
|
||||
"Attempt to use unbound parameter outside of the callee's value parameters"
|
||||
}
|
||||
valueParameters[unboundIndex++].second
|
||||
} else {
|
||||
val elements = mutableListOf<IrVarargElement>()
|
||||
while (unboundIndex < valueParameters.size) {
|
||||
val (param, value) = valueParameters[unboundIndex++]
|
||||
val substitutedParamType = param.type.substitute(superTypeArgumentsMap)
|
||||
if (substitutedParamType == parameter.varargElementType!!)
|
||||
elements += value
|
||||
else
|
||||
elements += IrSpreadElementImpl(irCall.startOffset, irCall.endOffset, value)
|
||||
}
|
||||
IrVarargImpl(
|
||||
irCall.startOffset, irCall.endOffset,
|
||||
parameter.type,
|
||||
parameter.varargElementType!!,
|
||||
elements
|
||||
)
|
||||
}
|
||||
}
|
||||
when (parameter) {
|
||||
function.dispatchReceiverParameter ->
|
||||
this.dispatchReceiver = argument.implicitCastIfNeededTo(function.dispatchReceiverParameter!!.type)
|
||||
|
||||
function.extensionReceiverParameter ->
|
||||
this.extensionReceiver = argument.implicitCastIfNeededTo(function.extensionReceiverParameter!!.type)
|
||||
|
||||
else ->
|
||||
putValueArgument(
|
||||
parameter.index,
|
||||
argument.implicitCastIfNeededTo(function.valueParameters[parameter.index].type)
|
||||
)
|
||||
}
|
||||
}
|
||||
assert(unboundIndex == valueParameters.size) { "Not all arguments of the callee are used" }
|
||||
for (index in 0 until irFunctionReference.typeArgumentsCount)
|
||||
putTypeArgument(index, irFunctionReference.getTypeArgument(index))
|
||||
}.implicitCastIfNeededTo(irCall.type)
|
||||
return this@FunctionInlining.visitExpression(super.visitExpression(immediateCall))
|
||||
}
|
||||
|
||||
override fun visitElement(element: IrElement) = element.accept(this, null)
|
||||
}
|
||||
@@ -369,7 +381,8 @@ class FunctionInlining(
|
||||
&& irCall.dispatchReceiver is IrGetValue
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------//
|
||||
private fun IrExpression.isAdaptedFunctionReference() =
|
||||
this is IrBlock && this.origin == IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE
|
||||
|
||||
private inner class ParameterToArgument(
|
||||
val parameter: IrValueParameter,
|
||||
@@ -379,7 +392,8 @@ class FunctionInlining(
|
||||
val isInlinableLambdaArgument: Boolean
|
||||
get() = parameter.isInlineParameter() &&
|
||||
(argumentExpression is IrFunctionReference
|
||||
|| argumentExpression is IrFunctionExpression)
|
||||
|| argumentExpression is IrFunctionExpression
|
||||
|| argumentExpression.isAdaptedFunctionReference())
|
||||
|
||||
val isImmutableVariableLoad: Boolean
|
||||
get() = argumentExpression.let { argument ->
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: BINDING_RECEIVERS
|
||||
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun foo(x: () -> Unit): String {
|
||||
x()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
inline fun String.id(s: String = this, vararg xs: Int): String = s
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String = foo("Fail"::id)
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: STDLIB_TEXT
|
||||
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun foo(mkString: () -> String): String =
|
||||
mkString()
|
||||
|
||||
inline fun bar (xs: CharArray = charArrayOf('O','K')) =
|
||||
String(xs)
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String = foo(::bar)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IGNORED_IN_JS
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun foo(f: (Int, Int) -> Int): Int =
|
||||
f(42, 117)
|
||||
|
||||
inline fun bar (vararg xs: Int): Int {
|
||||
var sum = 0
|
||||
for (x in xs) sum += x
|
||||
return sum
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String = if (foo(::bar) == 159) "OK" else "fail"
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
|
||||
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun foo(vararg l: Long, s: String = "OK"): String =
|
||||
if (l.size == 0) s else "Fail"
|
||||
|
||||
inline fun bar(f: () -> String): String = f()
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String = bar(::foo)
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun foo(x: (Int, Int) -> Int): Int =
|
||||
x(120,3)
|
||||
|
||||
inline fun bar(vararg x: Int): Int =
|
||||
x.sum()
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String =
|
||||
if (foo(::bar) == 123) "OK" else "FAIL"
|
||||
+40
@@ -1020,6 +1020,46 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -1020,6 +1020,46 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -1020,6 +1020,46 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -1020,6 +1020,46 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -1020,6 +1020,46 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -1020,6 +1020,46 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AdaptedReferences {
|
||||
@Test
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+38
@@ -770,6 +770,44 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class AdaptedReferences extends AbstractIrJsCodegenInlineES6Test {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+38
@@ -770,6 +770,44 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class AdaptedReferences extends AbstractIrJsCodegenInlineTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+38
@@ -770,6 +770,44 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/topLevelProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/adaptedReferences")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class AdaptedReferences extends AbstractJsCodegenInlineTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInAdaptedReferences() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/callableReference/adaptedReferences"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineDefault.kt")
|
||||
public void testInlineDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVararg.kt")
|
||||
public void testInlineVararg() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVarargAndDefault.kt")
|
||||
public void testInlineVarargAndDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargAndDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineVarargInts.kt")
|
||||
public void testInlineVarargInts() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/adaptedReferences/inlineVarargInts.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/callableReference/bound")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user