Minor. Add regression test
#KT-45539 Obsolete
This commit is contained in:
+6
@@ -9084,6 +9084,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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
|
@Test
|
||||||
@TestMetadata("kt45377.kt")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
|
class WrappedChannel<T>(channel: Channel<T> = Channel()): ReceiveChannel<T> by channel
|
||||||
|
|
||||||
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||||
|
it.getOrThrow()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Flow<out T> {
|
||||||
|
suspend fun collect(collector: FlowCollector<T>)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FlowCollector<in T> {
|
||||||
|
suspend fun emit(value: T)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> ReceiveChannel<T>.consumeAsFlow(): Flow<T> = ChannelAsFlow(this)
|
||||||
|
|
||||||
|
class ChannelAsFlow<T>(
|
||||||
|
private val channel: ReceiveChannel<T>
|
||||||
|
): ChannelFlow<T>() {
|
||||||
|
override suspend fun collect(collector: FlowCollector<T>) {
|
||||||
|
collector.emit(channel.receive())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ChannelFlow<T>: Flow<T>
|
||||||
|
|
||||||
|
var res = "FAIL"
|
||||||
|
|
||||||
|
object StringCollector : FlowCollector<String> {
|
||||||
|
override suspend fun emit(value: String) {
|
||||||
|
res = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReceiveChannel<out E> {
|
||||||
|
suspend fun receive(): E
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Channel<E>: ReceiveChannel<E>
|
||||||
|
|
||||||
|
fun <E> Channel(): Channel<E> = object : Channel<E> {
|
||||||
|
override suspend fun receive(): E {
|
||||||
|
return "OK" as E
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
builder {
|
||||||
|
WrappedChannel<String>().consumeAsFlow().collect(StringCollector)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
+6
@@ -9084,6 +9084,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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
|
@Test
|
||||||
@TestMetadata("kt45377.kt")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
|
|||||||
+6
@@ -9084,6 +9084,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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
|
@Test
|
||||||
@TestMetadata("kt45377.kt")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
|
|||||||
+10
-5
@@ -7094,6 +7094,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
||||||
@@ -15183,6 +15188,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class BoxReturnValueOnOverride extends AbstractLightAnalysisModeTest {
|
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 {
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
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);
|
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")
|
@TestMetadata("covariantOverrideChainErasedToAny.kt")
|
||||||
public void testCovariantOverrideChainErasedToAny() throws Exception {
|
public void testCovariantOverrideChainErasedToAny() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride/covariantOverrideChainErasedToAny.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/boxReturnValueOnOverride/covariantOverrideChainErasedToAny.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -6338,6 +6338,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
||||||
|
|||||||
Generated
+5
@@ -5759,6 +5759,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
||||||
|
|||||||
Generated
+5
@@ -5759,6 +5759,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/coroutines/kt44221.kt");
|
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")
|
@TestMetadata("kt45377.kt")
|
||||||
public void testKt45377() throws Exception {
|
public void testKt45377() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
runTest("compiler/testData/codegen/box/coroutines/kt45377.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user