is this a bug?
# getting-started
m
is this a bug?
l
yield
is a suspend function, so it can only be called within a suspend function or other coroutine context.
inner
is not marked as suspend, so it can’t call suspend functions.
m
So you can properly use buildMap, buildList, buildSet with inner functions, but you straight up can't with sequence?
l
None of those are suspend functions. You should be able to call them here. You can’t call
yield
, however, since it is a suspend function. You can use launch or runBlocking if you have to use it, depending on what you want to do.
Try marking inner as suspend
Copy code
suspend fun inner() {
    yield(3)
}
e
that won't work due to `@RestrictsSuspension`; this will:
Copy code
suspend fun SequenceScope<Int>.inner()
👍 2
m
Seems a bit convoluted to achieve the same as what I usually would do with the other "builders" but that works @ephemient, thanks