diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java index 3f59db197bd..ac7e9777fab 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java @@ -2732,6 +2732,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @Test + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @Test @TestMetadata("Modality.kt") public void testModality() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java index e3fc56035bf..6409a3b31b8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java @@ -2732,6 +2732,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest { runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @Test + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @Test @TestMetadata("Modality.kt") public void testModality() throws Exception { diff --git a/compiler/testData/ir/irText/firProblems/LocalSuspendFun.ir.txt b/compiler/testData/ir/irText/firProblems/LocalSuspendFun.ir.txt new file mode 100644 index 00000000000..0f6f119254d --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/LocalSuspendFun.ir.txt @@ -0,0 +1,20 @@ +FILE fqName: fileName:/LocalSuspendFun.kt + FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name:addNewStatusAction type:kotlin.coroutines.SuspendFunction0 [val] + CALL 'public final fun useMemo (callback: kotlin.Function0.useMemo>): T of .useMemo declared in ' type=kotlin.coroutines.SuspendFunction0 origin=null + : kotlin.coroutines.SuspendFunction0 + callback: FUN_EXPR type=kotlin.Function0> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.coroutines.SuspendFunction0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.coroutines.SuspendFunction0 declared in .foo' + FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=ANONYMOUS_FUNCTION + FUN LOCAL_FUNCTION name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] + BLOCK_BODY + FUN name:useMemo visibility:public modality:FINAL (callback:kotlin.Function0.useMemo>) returnType:T of .useMemo + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + VALUE_PARAMETER name:callback index:0 type:kotlin.Function0.useMemo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun useMemo (callback: kotlin.Function0.useMemo>): T of .useMemo declared in ' + CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of .useMemo origin=INVOKE + $this: GET_VAR 'callback: kotlin.Function0.useMemo> declared in .useMemo' type=kotlin.Function0.useMemo> origin=VARIABLE_AS_FUNCTION diff --git a/compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt b/compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt new file mode 100644 index 00000000000..a8b18050e64 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt @@ -0,0 +1,13 @@ +// ISSUE: KT-58332 + +fun foo() { + val addNewStatusAction: suspend () -> Unit = useMemo { + suspend fun() { + + } + } +} + +fun useMemo(callback: () -> T): T { + return callback() +} diff --git a/compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt.txt b/compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt.txt new file mode 100644 index 00000000000..301d555c352 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt.txt @@ -0,0 +1,12 @@ +fun foo() { + val addNewStatusAction: SuspendFunction0 = useMemo>(callback = local fun (): SuspendFunction0 { + return local suspend fun () { + } + + } +) +} + +fun useMemo(callback: Function0): T { + return callback.invoke() +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java index 01697902523..d9e7f1f1f80 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java @@ -2732,6 +2732,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @Test + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @Test @TestMetadata("Modality.kt") public void testModality() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java index f6d3252504a..092dee975e0 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java @@ -1965,6 +1965,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @TestMetadata("readWriteProperty.kt") public void testReadWriteProperty() throws Exception { runTest("compiler/testData/ir/irText/firProblems/readWriteProperty.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java index 3cf3b073020..80e2bfc2c5f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java @@ -2252,6 +2252,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @Test + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @Test @TestMetadata("readWriteProperty.kt") public void testReadWriteProperty() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java index 595f3ebf711..565d7651b81 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java @@ -2252,6 +2252,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest { runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @Test + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @Test @TestMetadata("readWriteProperty.kt") public void testReadWriteProperty() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java index 792d81b7625..3a744f59c81 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java @@ -2252,6 +2252,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest { runTest("compiler/testData/ir/irText/firProblems/localCompanion.kt"); } + @Test + @TestMetadata("LocalSuspendFun.kt") + public void testLocalSuspendFun() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/LocalSuspendFun.kt"); + } + @Test @TestMetadata("readWriteProperty.kt") public void testReadWriteProperty() throws Exception {