diff --git a/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt b/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt deleted file mode 100644 index 48e1babea57..00000000000 --- a/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt +++ /dev/null @@ -1,38 +0,0 @@ -// !LANGUAGE: +NewInference -// IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS -// NO_CHECK_LAMBDA_INLINING -// FILE: test.kt -// We cannot use COMMON_COROUTINES_TEST here due to !LANGUAGE directive -// TODO: Fix this - -inline fun go(f: () -> String) = f() - -// FILE: box.kt -// WITH_RUNTIME - -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resumeWith(result: Result) { - result.getOrThrow() - } - }) -} - -suspend fun String.id(): String = this - -fun box(): String { - val x = "OK" - var res = "FAIL" - builder { - res = go(x::id) - } - return res -} diff --git a/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt deleted file mode 100644 index 599930ca96d..00000000000 --- a/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !LANGUAGE: +NewInference -// IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS -// NO_CHECK_LAMBDA_INLINING -// FILE: test.kt - -inline suspend fun go(f: () -> String) = f() - -// FILE: box.kt -// WITH_RUNTIME - -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resumeWith(result: Result) { - result.getOrThrow() - } - }) -} - -suspend fun String.id(): String = this - -fun box(): String { - val x = "OK" - var res = "FAIL" - builder { - res = go(x::id) - } - return res -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.kt new file mode 100644 index 00000000000..300952271f2 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.kt @@ -0,0 +1,17 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_PARAMETER + +inline fun go1(f: () -> String) = f() +inline suspend fun go2(f: () -> String) = f() + +fun builder(c: suspend () -> Unit) {} + +suspend fun String.id(): String = this + +fun box() { + val x = "f" + builder { + go1(x::id) + go2(x::id) + } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.txt new file mode 100644 index 00000000000..1f21dd7413b --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.txt @@ -0,0 +1,7 @@ +package + +public fun box(): kotlin.Unit +public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit +public inline fun go1(/*0*/ f: () -> kotlin.String): kotlin.String +public suspend inline fun go2(/*0*/ f: () -> kotlin.String): kotlin.String +public suspend fun kotlin.String.id(): kotlin.String diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index db01bd07110..05d63957abc 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -1783,6 +1783,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW public void testProperty_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines"); } + + @TestMetadata("suspendConversionForCallableReferences.kt") + public void testSuspendConversionForCallableReferences() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.kt"); + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index fdf7742dcee..f26ec787f31 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -1783,6 +1783,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno public void testProperty_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines"); } + + @TestMetadata("suspendConversionForCallableReferences.kt") + public void testSuspendConversionForCallableReferences() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.kt"); + } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index e19339a5ff0..d0299257d43 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -3587,20 +3587,10 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/callableReference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("ordinaryParameter.kt") - public void testOrdinaryParameter() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt"); - } - @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/boxInline/suspend/callableReference/simple.kt"); } - - @TestMetadata("suspendOfOrdinary.kt") - public void testSuspendOfOrdinary() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt"); - } } @TestMetadata("compiler/testData/codegen/boxInline/suspend/defaultParameter") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index fbce461a698..c77c2a7d6dc 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3587,20 +3587,10 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/callableReference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("ordinaryParameter.kt") - public void testOrdinaryParameter() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt"); - } - @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/boxInline/suspend/callableReference/simple.kt"); } - - @TestMetadata("suspendOfOrdinary.kt") - public void testSuspendOfOrdinary() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt"); - } } @TestMetadata("compiler/testData/codegen/boxInline/suspend/defaultParameter") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index 0b23e3f1976..b76a203c7b6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -3587,20 +3587,10 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/callableReference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true); } - @TestMetadata("ordinaryParameter.kt") - public void testOrdinaryParameter() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt"); - } - @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/boxInline/suspend/callableReference/simple.kt"); } - - @TestMetadata("suspendOfOrdinary.kt") - public void testSuspendOfOrdinary() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt"); - } } @TestMetadata("compiler/testData/codegen/boxInline/suspend/defaultParameter") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrInlineSuspendTestsGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrInlineSuspendTestsGenerated.java index 466c77f0c6d..e41382dd0f8 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrInlineSuspendTestsGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrInlineSuspendTestsGenerated.java @@ -125,20 +125,10 @@ public class IrInlineSuspendTestsGenerated extends AbstractIrInlineSuspendTests KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/callableReference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true); } - @TestMetadata("ordinaryParameter.kt") - public void testOrdinaryParameter() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt"); - } - @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/boxInline/suspend/callableReference/simple.kt"); } - - @TestMetadata("suspendOfOrdinary.kt") - public void testSuspendOfOrdinary() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt"); - } } @TestMetadata("compiler/testData/codegen/boxInline/suspend/defaultParameter") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/InlineSuspendTestsGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/InlineSuspendTestsGenerated.java index 5023e4f1b77..928b4c463f9 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/InlineSuspendTestsGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/InlineSuspendTestsGenerated.java @@ -200,20 +200,10 @@ public class InlineSuspendTestsGenerated extends AbstractInlineSuspendTests { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/suspend/callableReference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); } - @TestMetadata("ordinaryParameter.kt") - public void testOrdinaryParameter() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt"); - } - @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/boxInline/suspend/callableReference/simple.kt"); } - - @TestMetadata("suspendOfOrdinary.kt") - public void testSuspendOfOrdinary() throws Exception { - runTest("compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt"); - } } @TestMetadata("compiler/testData/codegen/boxInline/suspend/defaultParameter")