https://kotlinlang.org logo
#coroutines
Title
# coroutines
g

groostav

07/23/2018, 7:51 AM
also, does anybody else things its strange that
select {}
will simply abandon your coroutine?
Copy code
@Test fun `using an empty select clause just abandons you`() = runBlocking {

        val producer = produce<String> {
            select<String> {
                val x = 4;
            }

            val y = 4;
        }

        val result = producer.receiveOrNull()

        val z = 4;
    }
never completes
e

elizarov

07/23/2018, 8:06 AM
select {}
(without clauses) will never resume. Just like
suspendCoroutine {}
. Conceptually, just like
while (true) {}
.
We should have some kind of inspection or runtime exception, though
👍 1
g

groostav

07/23/2018, 8:10 AM
can you not set a flag in the
registerSelectClause
implementations, then throw an exception if that flag is not set?
also, I've got a
java.lang.ClassCastException: ...ProducerCoroutine cannot be cast to ...SelectClause1
from a fairly innocuous code, i just reduced it a little, should I submit this to kotlinx.coroutines or youtrack/KT?
e

elizarov

07/23/2018, 8:30 AM
Please, file a bug to GitHub
🐿️ 1
4 Views