diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt new file mode 100644 index 00000000000..a4df277004d --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt @@ -0,0 +1,18 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +class Scope + +fun simpleAsync0(block: Scope.() -> T) {} +fun simpleAsync1(block: suspend Scope.() -> T) {} +suspend fun simpleAsync2(block: Scope.() -> T) {} +suspend fun simpleAsync3(block: suspend Scope.() -> T) {} + +fun insideJob0() = doTheJob0() +fun insideJob1() = doTheJob1() +suspend fun insideJob2() = doTheJob2() +suspend fun insideJob3() = doTheJob3() + +fun doTheJob0() = simpleAsync0 { insideJob0() } +fun doTheJob1() = simpleAsync1 { insideJob1() } +suspend fun doTheJob2() = simpleAsync2 { insideJob2() } +suspend fun doTheJob3() = simpleAsync3 { insideJob3() } diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.txt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.txt new file mode 100644 index 00000000000..170d73dbb4c --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.txt @@ -0,0 +1,21 @@ +package + +public fun doTheJob0(): kotlin.Unit +public fun doTheJob1(): kotlin.Unit +public suspend fun doTheJob2(): kotlin.Unit +public suspend fun doTheJob3(): kotlin.Unit +public fun insideJob0(): kotlin.Unit +public fun insideJob1(): kotlin.Unit +public suspend fun insideJob2(): kotlin.Unit +public suspend fun insideJob3(): kotlin.Unit +public fun simpleAsync0(/*0*/ block: Scope.() -> T): kotlin.Unit +public fun simpleAsync1(/*0*/ block: suspend Scope.() -> T): kotlin.Unit +public suspend fun simpleAsync2(/*0*/ block: Scope.() -> T): kotlin.Unit +public suspend fun simpleAsync3(/*0*/ block: suspend Scope.() -> T): kotlin.Unit + +public final class Scope { + public constructor Scope() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index c130899d142..f5eb5dc039f 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -9890,6 +9890,24 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { } } + @TestMetadata("compiler/testData/diagnostics/tests/inference/recursiveCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class RecursiveCalls extends AbstractDiagnosticsTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInRecursiveCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("kt23531.kt") + public void testKt23531() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt"); + } + } + @TestMetadata("compiler/testData/diagnostics/tests/inference/recursiveLocalFuns") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 26b2b7917c1..e55aa7d6b67 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -9890,6 +9890,24 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing } } + @TestMetadata("compiler/testData/diagnostics/tests/inference/recursiveCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class RecursiveCalls extends AbstractDiagnosticsUsingJavacTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInRecursiveCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("kt23531.kt") + public void testKt23531() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.kt"); + } + } + @TestMetadata("compiler/testData/diagnostics/tests/inference/recursiveLocalFuns") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)