after upgrading to Kotlin 1.2.60 I get weird compi...
# coroutines
u
after upgrading to Kotlin 1.2.60 I get weird compiler errors regarding `@RestrictsSuspension`:
Copy code
@RestrictsSuspension
    class Foo() {
        suspend fun bar() = Unit
    }

    // ERROR: Restricted suspending functions can only invoke member or extension suspending functions on their restricted coroutine scope
    fun yUnoWork() = runBlocking { Foo().bar() }
i
In short: this is by design. In order to call restricted function you should have different coroutine builder. Like this:
Copy code
fun fooBuilder(c: suspend Foo.() -> Unit) ...
Your code snippet worked in 1.2.50 due to a bug: https://youtrack.jetbrains.com/issue/KT-24859
u
@Ilmir Usmanov [JB] I'm not sure I follow. As I said, it works with 1.2.60 in a standard kotlin/jvm gradle project in IDEA.
hm, turns out I was using an old version of the Kotlin plugin in IDEA 😕