JVM: Suspend conversion for function references
This commit is contained in:
@@ -136,7 +136,8 @@ class JvmRuntimeTypes(
|
||||
referencedFunction: FunctionDescriptor,
|
||||
anonymousFunctionDescriptor: AnonymousFunctionDescriptor,
|
||||
isBound: Boolean,
|
||||
isAdaptedCallableReference: Boolean
|
||||
isAdaptedCallableReference: Boolean,
|
||||
isSuspendConversion: Boolean
|
||||
): Collection<KotlinType> {
|
||||
val receivers = computeExpectedNumberOfReceivers(referencedFunction, isBound)
|
||||
|
||||
@@ -148,7 +149,7 @@ class JvmRuntimeTypes(
|
||||
anonymousFunctionDescriptor.valueParameters.drop(receivers).map { it.type },
|
||||
null,
|
||||
anonymousFunctionDescriptor.returnType!!,
|
||||
referencedFunction.isSuspend
|
||||
referencedFunction.isSuspend || isSuspendConversion
|
||||
)
|
||||
|
||||
val suspendFunctionType = if (referencedFunction.isSuspend) suspendFunctionInterface?.defaultType else null
|
||||
|
||||
+15
-4
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.resolve.sam.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -54,6 +53,7 @@ import org.jetbrains.kotlin.resolve.constants.EnumValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.NullValue;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionsOnDeclarationBodyChecker;
|
||||
import org.jetbrains.kotlin.resolve.sam.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
|
||||
@@ -360,8 +360,11 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
|
||||
private boolean isAdaptedCallableReference(
|
||||
@NotNull KtCallableReferenceExpression expression,
|
||||
@NotNull ResolvedCall<?> resolvedCall
|
||||
@NotNull ResolvedCall<?> resolvedCall,
|
||||
boolean isSuspendConversion
|
||||
) {
|
||||
if (isSuspendConversion) return true;
|
||||
|
||||
CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
|
||||
if (!(resultingDescriptor instanceof FunctionDescriptor)) return false;
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) resultingDescriptor;
|
||||
@@ -401,12 +404,20 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
Collection<KotlinType> supertypes;
|
||||
|
||||
if (target instanceof FunctionDescriptor) {
|
||||
FunctionDescriptor targetFunction = (FunctionDescriptor) target;
|
||||
callableDescriptor = bindingContext.get(FUNCTION, expression);
|
||||
if (callableDescriptor == null) return;
|
||||
|
||||
KotlinType functionReferenceType = bindingContext.getType(expression);
|
||||
boolean isSuspendConversion =
|
||||
!targetFunction.isSuspend() &&
|
||||
functionReferenceType != null &&
|
||||
FunctionTypesKt.isKSuspendFunctionType(functionReferenceType);
|
||||
|
||||
supertypes = runtimeTypes.getSupertypesForFunctionReference(
|
||||
(FunctionDescriptor) target, (AnonymousFunctionDescriptor) callableDescriptor, receiverType != null,
|
||||
isAdaptedCallableReference(expression, referencedFunction)
|
||||
targetFunction, (AnonymousFunctionDescriptor) callableDescriptor, receiverType != null,
|
||||
isAdaptedCallableReference(expression, referencedFunction, isSuspendConversion),
|
||||
isSuspendConversion
|
||||
);
|
||||
}
|
||||
else if (target instanceof PropertyDescriptor) {
|
||||
|
||||
Generated
+78
@@ -2114,6 +2114,84 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
public void testVarargWithDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/varargWithDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendConversion extends AbstractFirBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithCoercionToUnit.kt")
|
||||
public void testAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithDefaultArguments.kt")
|
||||
public void testAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithVarargs.kt")
|
||||
public void testAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("bound.kt")
|
||||
public void testBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/bound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossInline.kt")
|
||||
public void testCrossInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/crossInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithCoercionToUnit.kt")
|
||||
public void testInlineAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithDefaultArguments.kt")
|
||||
public void testInlineAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithVarargs.kt")
|
||||
public void testInlineAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimple.kt")
|
||||
public void testInlineSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineWithParameters.kt")
|
||||
public void testInlineWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameters.kt")
|
||||
public void testWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/withParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound")
|
||||
|
||||
+29
-19
@@ -95,10 +95,13 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
|
||||
override fun visitFunctionReference(expression: IrFunctionReference) {
|
||||
expression.acceptChildrenVoid(this)
|
||||
if (expression.isSuspend && expression.origin == IrStatementOrigin.LAMBDA && expression !in inlineReferences) {
|
||||
if (expression.isSuspend && expression.isLambdaOrAdaptedCallableReference() && expression !in inlineReferences) {
|
||||
suspendLambdas[expression] = SuspendLambdaInfo(expression)
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrFunctionReference.isLambdaOrAdaptedCallableReference() =
|
||||
origin == IrStatementOrigin.LAMBDA || origin == IrStatementOrigin.ADAPTED_FUNCTION_REFERENCE
|
||||
})
|
||||
|
||||
for (lambda in suspendLambdas.values) {
|
||||
@@ -207,7 +210,11 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrClass.addInvokeSuspendForLambda(irFunction: IrFunction, fields: List<IrField>, receiverField: IrField?): IrSimpleFunction {
|
||||
private fun IrClass.addInvokeSuspendForLambda(
|
||||
irFunction: IrFunction,
|
||||
fields: List<IrField>,
|
||||
receiverField: IrField?
|
||||
): IrSimpleFunction {
|
||||
val superMethod = context.ir.symbols.suspendLambdaClass.functions.single {
|
||||
it.owner.name.asString() == INVOKE_SUSPEND_METHOD_NAME && it.owner.valueParameters.size == 1 &&
|
||||
it.owner.valueParameters[0].type.isKotlinResult()
|
||||
@@ -425,24 +432,25 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrClass.addConstructorForNamedFunction(capturedThisField: IrField?, capturesCrossinline: Boolean): IrConstructor = addConstructor {
|
||||
isPrimary = true
|
||||
returnType = defaultType
|
||||
visibility = if (capturesCrossinline) Visibilities.PUBLIC else JavaVisibilities.PACKAGE_VISIBILITY
|
||||
}.also { constructor ->
|
||||
val capturedThisParameter = capturedThisField?.let { constructor.addValueParameter(it.name.asString(), it.type) }
|
||||
val completionParameterSymbol = constructor.addCompletionValueParameter()
|
||||
private fun IrClass.addConstructorForNamedFunction(capturedThisField: IrField?, capturesCrossinline: Boolean): IrConstructor =
|
||||
addConstructor {
|
||||
isPrimary = true
|
||||
returnType = defaultType
|
||||
visibility = if (capturesCrossinline) Visibilities.PUBLIC else JavaVisibilities.PACKAGE_VISIBILITY
|
||||
}.also { constructor ->
|
||||
val capturedThisParameter = capturedThisField?.let { constructor.addValueParameter(it.name.asString(), it.type) }
|
||||
val completionParameterSymbol = constructor.addCompletionValueParameter()
|
||||
|
||||
val superClassConstructor = context.ir.symbols.continuationImplClass.owner.constructors.single { it.valueParameters.size == 1 }
|
||||
constructor.body = context.createIrBuilder(constructor.symbol).irBlockBody {
|
||||
if (capturedThisField != null) {
|
||||
+irSetField(irGet(thisReceiver!!), capturedThisField, irGet(capturedThisParameter!!))
|
||||
}
|
||||
+irDelegatingConstructorCall(superClassConstructor).also {
|
||||
it.putValueArgument(0, irGet(completionParameterSymbol))
|
||||
val superClassConstructor = context.ir.symbols.continuationImplClass.owner.constructors.single { it.valueParameters.size == 1 }
|
||||
constructor.body = context.createIrBuilder(constructor.symbol).irBlockBody {
|
||||
if (capturedThisField != null) {
|
||||
+irSetField(irGet(thisReceiver!!), capturedThisField, irGet(capturedThisParameter!!))
|
||||
}
|
||||
+irDelegatingConstructorCall(superClassConstructor).also {
|
||||
it.putValueArgument(0, irGet(completionParameterSymbol))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrClass.addInvokeSuspendForNamedFunction(
|
||||
irFunction: IrFunction,
|
||||
@@ -708,8 +716,10 @@ private fun <T : IrFunctionAccessExpression> T.retargetToSuspendView(
|
||||
val continuation = if (caller.origin == IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA)
|
||||
context.fakeContinuation
|
||||
else
|
||||
IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, caller.continuationParameter()?.symbol
|
||||
?: throw AssertionError("${caller.render()} has no continuation; can't call ${symbol.owner.render()}"))
|
||||
IrGetValueImpl(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, caller.continuationParameter()?.symbol
|
||||
?: throw AssertionError("${caller.render()} has no continuation; can't call ${symbol.owner.render()}")
|
||||
)
|
||||
it.putValueArgument(continuationIndex, continuation)
|
||||
}
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var test = "failed"
|
||||
|
||||
fun foo(s: String): String {
|
||||
test = s + "K"
|
||||
return test
|
||||
}
|
||||
|
||||
suspend fun invokeSuspend(fn: suspend (String) -> Unit, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
runSuspend {
|
||||
invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun foo(s1: String, s2: String = "K"): String = s1 + s2
|
||||
|
||||
suspend fun invokeSuspend(fn: suspend (String) -> String, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
var test = "failed"
|
||||
runSuspend {
|
||||
test = invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun foo(vararg ss: String): String = ss[0] + "K"
|
||||
|
||||
suspend fun invokeSuspend(fn: suspend (String) -> String, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
var test = "failed"
|
||||
runSuspend {
|
||||
test = invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// ^ this test hangs on JS_IR (even if it's IGNOREd)
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
class C {
|
||||
var test = "failed"
|
||||
|
||||
fun foo() {
|
||||
test = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
runSuspend(c::foo)
|
||||
return c.test
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var test = "failed"
|
||||
|
||||
fun foo() { test = "OK" }
|
||||
|
||||
inline suspend fun invokeSuspend(crossinline fn: suspend () -> Unit) = suspend { fn() }
|
||||
|
||||
fun box(): String {
|
||||
runSuspend {
|
||||
invokeSuspend(::foo)()
|
||||
}
|
||||
return test
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var test = "failed"
|
||||
|
||||
fun foo(s: String): String {
|
||||
test = s + "K"
|
||||
return test
|
||||
}
|
||||
|
||||
inline suspend fun invokeSuspend(fn: suspend (String) -> Unit, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
runSuspend {
|
||||
invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun foo(s1: String, s2: String = "K"): String = s1 + s2
|
||||
|
||||
inline suspend fun invokeSuspend(fn: suspend (String) -> String, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
var test = "failed"
|
||||
runSuspend {
|
||||
test = invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun foo(vararg ss: String): String = ss[0] + "K"
|
||||
|
||||
inline suspend fun invokeSuspend(fn: suspend (String) -> String, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
var test = "failed"
|
||||
runSuspend {
|
||||
test = invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// ^ this test hangs on JS_IR (even if it's IGNOREd)
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
inline suspend fun invokeSuspend(fn: suspend () -> Unit) = fn()
|
||||
|
||||
class C {
|
||||
var test = "failed"
|
||||
|
||||
fun foo() {
|
||||
test = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
runSuspend {
|
||||
invokeSuspend(c::foo)
|
||||
}
|
||||
return c.test
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var test = "failed"
|
||||
|
||||
fun foo() { test = "OK" }
|
||||
|
||||
inline suspend fun invokeSuspend(fn: suspend () -> Unit) { fn() }
|
||||
|
||||
fun box(): String {
|
||||
runSuspend {
|
||||
invokeSuspend(::foo)
|
||||
}
|
||||
return test
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun foo(s: String): String = s + "K"
|
||||
|
||||
inline suspend fun invokeSuspend(fn: suspend (String) -> String, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
var test = "failed"
|
||||
runSuspend {
|
||||
test = invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var test = "failed"
|
||||
|
||||
fun foo() { test = "OK" }
|
||||
|
||||
fun box(): String {
|
||||
runSuspend(::foo)
|
||||
return test
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun runSuspend(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun foo(s: String): String = s + "K"
|
||||
|
||||
suspend fun invokeSuspend(fn: suspend (String) -> String, arg: String) = fn.invoke(arg)
|
||||
|
||||
fun box(): String {
|
||||
var test = "failed"
|
||||
runSuspend {
|
||||
test = invokeSuspend(::foo, "O")
|
||||
}
|
||||
return test
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
// FILE: suspendCovnersion.kt
|
||||
|
||||
fun checkNotEqual(x: Any, y: Any) {
|
||||
if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal")
|
||||
}
|
||||
|
||||
fun capturePlain(fn: () -> Unit): Any = fn
|
||||
fun captureSuspend(fn: suspend () -> Unit): Any = fn
|
||||
fun capturePlainInt(fn: (Int) -> Unit): Any = fn
|
||||
fun captureSuspendInt(fn: suspend (Int) -> Unit): Any = fn
|
||||
|
||||
fun foo() {}
|
||||
|
||||
class C {
|
||||
fun memberFun() {}
|
||||
}
|
||||
|
||||
fun fnWithVararg(vararg xs: Int) {}
|
||||
|
||||
fun fnWithDefault(x1: Int = 1, x2: Int = 2) {}
|
||||
|
||||
fun fnReturnsInt() = 1
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
|
||||
checkNotEqual(capturePlain(::foo), captureSuspend(::foo))
|
||||
checkNotEqual(capturePlain(c::memberFun), captureSuspend(c::memberFun))
|
||||
|
||||
checkNotEqual(captureOther1(), captureOther2())
|
||||
checkNotEqual(captureBoundOther1(c), captureBoundOther2(c))
|
||||
|
||||
checkNotEqual(capturePlainInt(::fnWithVararg), captureSuspendInt(::fnWithVararg))
|
||||
checkNotEqual(captureSuspend(::fnWithVararg), captureSuspendInt(::fnWithVararg))
|
||||
|
||||
checkNotEqual(capturePlainInt(::fnWithDefault), captureSuspendInt(::fnWithDefault))
|
||||
checkNotEqual(captureSuspend(::fnWithDefault), captureSuspendInt(::fnWithDefault))
|
||||
|
||||
checkNotEqual(capturePlain(::fnReturnsInt), captureSuspend(::fnReturnsInt))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: fromOtherFile.kt
|
||||
|
||||
fun captureOther1() = capturePlain(::foo)
|
||||
fun captureOther2() = captureSuspend(::foo)
|
||||
|
||||
fun captureBoundOther1(c: C) = capturePlain(c::memberFun)
|
||||
fun captureBoundOther2(c: C) = captureSuspend(c::memberFun)
|
||||
+78
@@ -2134,6 +2134,84 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
public void testVarargWithDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/varargWithDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendConversion extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithCoercionToUnit.kt")
|
||||
public void testAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithDefaultArguments.kt")
|
||||
public void testAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithVarargs.kt")
|
||||
public void testAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("bound.kt")
|
||||
public void testBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/bound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossInline.kt")
|
||||
public void testCrossInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/crossInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithCoercionToUnit.kt")
|
||||
public void testInlineAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithDefaultArguments.kt")
|
||||
public void testInlineAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithVarargs.kt")
|
||||
public void testInlineAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimple.kt")
|
||||
public void testInlineSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineWithParameters.kt")
|
||||
public void testInlineWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameters.kt")
|
||||
public void testWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/withParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound")
|
||||
|
||||
+78
@@ -2134,6 +2134,84 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
public void testVarargWithDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/varargWithDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendConversion extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithCoercionToUnit.kt")
|
||||
public void testAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithDefaultArguments.kt")
|
||||
public void testAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithVarargs.kt")
|
||||
public void testAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("bound.kt")
|
||||
public void testBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/bound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossInline.kt")
|
||||
public void testCrossInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/crossInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithCoercionToUnit.kt")
|
||||
public void testInlineAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithDefaultArguments.kt")
|
||||
public void testInlineAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithVarargs.kt")
|
||||
public void testInlineAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimple.kt")
|
||||
public void testInlineSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineWithParameters.kt")
|
||||
public void testInlineWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameters.kt")
|
||||
public void testWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/withParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound")
|
||||
|
||||
+78
@@ -2114,6 +2114,84 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
public void testVarargWithDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/varargWithDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendConversion extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithCoercionToUnit.kt")
|
||||
public void testAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithDefaultArguments.kt")
|
||||
public void testAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithVarargs.kt")
|
||||
public void testAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("bound.kt")
|
||||
public void testBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/bound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossInline.kt")
|
||||
public void testCrossInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/crossInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithCoercionToUnit.kt")
|
||||
public void testInlineAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithDefaultArguments.kt")
|
||||
public void testInlineAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithVarargs.kt")
|
||||
public void testInlineAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBound.kt")
|
||||
public void testInlineBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimple.kt")
|
||||
public void testInlineSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineWithParameters.kt")
|
||||
public void testInlineWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameters.kt")
|
||||
public void testWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/withParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound")
|
||||
|
||||
Generated
+68
@@ -1544,6 +1544,74 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
public void testVarargWithDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/varargWithDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendConversion extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithCoercionToUnit.kt")
|
||||
public void testAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithDefaultArguments.kt")
|
||||
public void testAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithVarargs.kt")
|
||||
public void testAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("crossInline.kt")
|
||||
public void testCrossInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/crossInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithCoercionToUnit.kt")
|
||||
public void testInlineAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithDefaultArguments.kt")
|
||||
public void testInlineAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithVarargs.kt")
|
||||
public void testInlineAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimple.kt")
|
||||
public void testInlineSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineWithParameters.kt")
|
||||
public void testInlineWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameters.kt")
|
||||
public void testWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/withParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound")
|
||||
|
||||
+68
@@ -1544,6 +1544,74 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
public void testVarargWithDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/varargWithDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspendConversion extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithCoercionToUnit.kt")
|
||||
public void testAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithDefaultArguments.kt")
|
||||
public void testAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("adaptedWithVarargs.kt")
|
||||
public void testAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/adaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspendConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("crossInline.kt")
|
||||
public void testCrossInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/crossInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithCoercionToUnit.kt")
|
||||
public void testInlineAdaptedWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithCoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithDefaultArguments.kt")
|
||||
public void testInlineAdaptedWithDefaultArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithDefaultArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineAdaptedWithVarargs.kt")
|
||||
public void testInlineAdaptedWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineAdaptedWithVarargs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineSimple.kt")
|
||||
public void testInlineSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineWithParameters.kt")
|
||||
public void testInlineWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/inlineWithParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withParameters.kt")
|
||||
public void testWithParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/suspendConversion/withParameters.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound")
|
||||
|
||||
Reference in New Issue
Block a user