From f9226841698132df5fe2644873f7984f308885ef Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Sun, 29 May 2022 19:19:47 +0200 Subject: [PATCH] Minor. Add regression test #KT-52561 Fixed --- .../FirBlackBoxCodegenTestGenerated.java | 6 ++++ .../codegen/box/coroutines/kt52561.kt | 31 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 ++++ .../IrBlackBoxCodegenTestGenerated.java | 6 ++++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../js/test/JsCodegenBoxTestGenerated.java | 6 ++++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 ++++ .../IrCodegenBoxWasmTestGenerated.java | 5 +++ .../NativeCodegenBoxTestGenerated.java | 6 ++++ 9 files changed, 77 insertions(+) create mode 100644 compiler/testData/codegen/box/coroutines/kt52561.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 44e20a83b21..b5423e9b0e2 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -10251,6 +10251,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @Test + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @Test @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { diff --git a/compiler/testData/codegen/box/coroutines/kt52561.kt b/compiler/testData/codegen/box/coroutines/kt52561.kt new file mode 100644 index 00000000000..366aff744ce --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/kt52561.kt @@ -0,0 +1,31 @@ +// WITH_STDLIB +// WITH_COROUTINES +import helpers.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* + +fun someCondition() = true + +suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn { + it.resume(Unit) + COROUTINE_SUSPENDED +} + +fun expectString(x: String?) { + if (x != "TEST") error("FAIL: $x") +} + +suspend fun test(block: (String) -> Unit) { + val string: String? = "TEST".takeIf { true } + check(string != null) // smartcast from String? to String + expectString(string) + suspendHere() + expectString(string) + block(string) +} + + +fun box(): String { + suspend { test {} }.startCoroutine(EmptyContinuation) + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index ab79abd4418..22e94a57e0f 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -10131,6 +10131,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @Test + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @Test @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index a4123707100..401b8ec9871 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -10251,6 +10251,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @Test + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @Test @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 0c914fa9957..44f020f4804 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7964,6 +7964,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index bbc75a6d9bf..98718c5eb60 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -7193,6 +7193,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @Test + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @Test @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 70ee720ecfa..fcfa7f8743f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -7235,6 +7235,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @Test + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @Test @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index d78664c5117..ee45a53d2a1 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -6364,6 +6364,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception { runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt"); diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 56c1980b76b..cc9d51cb6c5 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -8095,6 +8095,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/coroutines/kt52311_nullOnRight.kt"); } + @Test + @TestMetadata("kt52561.kt") + public void testKt52561() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt52561.kt"); + } + @Test @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop() throws Exception {