From 0c02463e1d1dbacdabc29a89367990e307b6022b Mon Sep 17 00:00:00 2001 From: Andrey Cherkasov Date: Wed, 18 Mar 2026 00:46:12 +0400 Subject: [PATCH] [kotlin] KTIJ-37358 Add more tests GitOrigin-RevId: d43d4fffb149a8642a5f7e1863fa65a0a9f04ecd --- .../fixes/HighLevelQuickFixTestGenerated.java | 10 ++++++++++ .../quickfix/K1QuickFixTestGenerated.java | 10 ++++++++++ ...licitThisLaunchWithNullableTypeArgument.kt | 18 ++++++++++++++++++ ...hisLaunchWithNullableTypeArgument.kt.after | 19 +++++++++++++++++++ .../implicitThisLaunchWithTypeArgument.kt | 17 +++++++++++++++++ ...mplicitThisLaunchWithTypeArgument.kt.after | 18 ++++++++++++++++++ 6 files changed, 92 insertions(+) create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt.after create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt.after diff --git a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java index 4f7315788851..3330c123f013 100644 --- a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java +++ b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java @@ -13400,6 +13400,11 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu runTest("../../../idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunch.kt"); } + @TestMetadata("explicitThisLaunchWithNullableTypeArgument.kt") + public void testExplicitThisLaunchWithNullableTypeArgument() throws Exception { + runTest("../../../idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt"); + } + @TestMetadata("implicitReceiverCoroutineContext.kt") public void testImplicitReceiverCoroutineContext() throws Exception { runTest("../../../idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitReceiverCoroutineContext.kt"); @@ -13410,6 +13415,11 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu runTest("../../../idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitReceiverLaunch.kt"); } + @TestMetadata("implicitThisLaunchWithTypeArgument.kt") + public void testImplicitThisLaunchWithTypeArgument() throws Exception { + runTest("../../../idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt"); + } + @TestMetadata("inNonSuspendLambda.kt") public void testInNonSuspendLambda() throws Exception { runTest("../../../idea/tests/testData/quickfix/runBlockingInSuspendFunction/inNonSuspendLambda.kt"); diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java index 527fa00b0806..7402282b53e5 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java @@ -16533,6 +16533,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest { runTest("testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunch.kt"); } + @TestMetadata("explicitThisLaunchWithNullableTypeArgument.kt") + public void testExplicitThisLaunchWithNullableTypeArgument() throws Exception { + runTest("testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt"); + } + @TestMetadata("implicitReceiverCoroutineContext.kt") public void testImplicitReceiverCoroutineContext() throws Exception { runTest("testData/quickfix/runBlockingInSuspendFunction/implicitReceiverCoroutineContext.kt"); @@ -16543,6 +16548,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest { runTest("testData/quickfix/runBlockingInSuspendFunction/implicitReceiverLaunch.kt"); } + @TestMetadata("implicitThisLaunchWithTypeArgument.kt") + public void testImplicitThisLaunchWithTypeArgument() throws Exception { + runTest("testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt"); + } + @TestMetadata("inNonSuspendLambda.kt") public void testInNonSuspendLambda() throws Exception { runTest("testData/quickfix/runBlockingInSuspendFunction/inNonSuspendLambda.kt"); diff --git a/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt new file mode 100644 index 000000000000..9eaee4193762 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt @@ -0,0 +1,18 @@ +// "Fix all ''runBlocking' inside suspend function' problems in file" "true" +// WITH_COROUTINES + +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking + +suspend fun main() { + var v = runBlocking { + this.launch { + println("Hello, World!") + } + "foo" + } + v = null; +} + +// FUS_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention +// FUS_K2_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt.after new file mode 100644 index 000000000000..e4660388dce3 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/explicitThisLaunchWithNullableTypeArgument.kt.after @@ -0,0 +1,19 @@ +// "Fix all ''runBlocking' inside suspend function' problems in file" "true" +// WITH_COROUTINES + +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking + +suspend fun main() { + var v = coroutineScope { + this.launch { + println("Hello, World!") + } + "foo" + } + v = null; +} + +// FUS_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention +// FUS_K2_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt new file mode 100644 index 000000000000..79b263ec845d --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt @@ -0,0 +1,17 @@ +// "Fix all ''runBlocking' inside suspend function' problems in file" "true" +// WITH_COROUTINES + +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking + +suspend fun main() { + val v = runBlocking { + launch { + println("Hello, World!") + } + "foo" + } +} + +// FUS_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention +// FUS_K2_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt.after new file mode 100644 index 000000000000..44edc7447cea --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/runBlockingInSuspendFunction/implicitThisLaunchWithTypeArgument.kt.after @@ -0,0 +1,18 @@ +// "Fix all ''runBlocking' inside suspend function' problems in file" "true" +// WITH_COROUTINES + +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking + +suspend fun main() { + val v = coroutineScope { + launch { + println("Hello, World!") + } + "foo" + } +} + +// FUS_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention +// FUS_K2_QUICKFIX_NAME: com.intellij.codeInspection.actions.CleanupInspectionIntention \ No newline at end of file