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 ddd4f6c382e..05d6feee615 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 @@ -9084,6 +9084,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @Test + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @Test @TestMetadata("kt45377.kt") public void testKt45377() throws Exception { diff --git a/compiler/testData/codegen/box/coroutines/kt44710.kt b/compiler/testData/codegen/box/coroutines/kt44710.kt new file mode 100644 index 00000000000..701797c3652 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/kt44710.kt @@ -0,0 +1,59 @@ +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +import kotlin.coroutines.* + +class WrappedChannel(channel: Channel = Channel()): ReceiveChannel by channel + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) +} + +interface Flow { + suspend fun collect(collector: FlowCollector) +} + +interface FlowCollector { + suspend fun emit(value: T) +} + +fun ReceiveChannel.consumeAsFlow(): Flow = ChannelAsFlow(this) + +class ChannelAsFlow( + private val channel: ReceiveChannel +): ChannelFlow() { + override suspend fun collect(collector: FlowCollector) { + collector.emit(channel.receive()) + } +} + +abstract class ChannelFlow: Flow + +var res = "FAIL" + +object StringCollector : FlowCollector { + override suspend fun emit(value: String) { + res = value + } +} + +interface ReceiveChannel { + suspend fun receive(): E +} + +interface Channel: ReceiveChannel + +fun Channel(): Channel = object : Channel { + override suspend fun receive(): E { + return "OK" as E + } +} + +fun box(): String { + builder { + WrappedChannel().consumeAsFlow().collect(StringCollector) + } + return res +} \ 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 c8f6c084863..4f6e22cae06 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 @@ -9084,6 +9084,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @Test + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @Test @TestMetadata("kt45377.kt") public void testKt45377() 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 b9bfa4e052e..a6ead646add 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 @@ -9084,6 +9084,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @Test + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @Test @TestMetadata("kt45377.kt") public void testKt45377() 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 b9e31487f21..d494a8ca4ff 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7094,6 +7094,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @TestMetadata("kt45377.kt") public void testKt45377() throws Exception { runTest("compiler/testData/codegen/box/coroutines/kt45377.kt"); @@ -15183,6 +15188,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class BoxReturnValueOnOverride extends AbstractLightAnalysisModeTest { + @TestMetadata("boxReturnValueInDefaultMethod.kt") + public void ignoreBoxReturnValueInDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride/boxReturnValueInDefaultMethod.kt"); + } + private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -15191,11 +15201,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("boxReturnValueInDefaultMethod.kt") - public void testBoxReturnValueInDefaultMethod() throws Exception { - runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride/boxReturnValueInDefaultMethod.kt"); - } - @TestMetadata("covariantOverrideChainErasedToAny.kt") public void testCovariantOverrideChainErasedToAny() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride/covariantOverrideChainErasedToAny.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index cd9be8ce8da..7d17ad8dbc8 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -6338,6 +6338,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @TestMetadata("kt45377.kt") public void testKt45377() throws Exception { runTest("compiler/testData/codegen/box/coroutines/kt45377.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index b995b01a53f..42442ea8572 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -5759,6 +5759,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @TestMetadata("kt45377.kt") public void testKt45377() throws Exception { runTest("compiler/testData/codegen/box/coroutines/kt45377.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index ff3650db5b7..a8cf2c58a7e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -5759,6 +5759,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt44221.kt"); } + @TestMetadata("kt44710.kt") + public void testKt44710() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt44710.kt"); + } + @TestMetadata("kt45377.kt") public void testKt45377() throws Exception { runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");