Report error when suspend call is illegal in the scope

Namely when it's not contained inside coroutine or another suspend function

 #KT-14924 In Progress
This commit is contained in:
Denis Zharkov
2016-11-30 14:59:58 +03:00
parent 240d82d167
commit aa50f1d824
6 changed files with 38 additions and 2 deletions
@@ -0,0 +1,13 @@
suspend fun foo() {}
fun noSuspend() {
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>foo<!>()
}
class A {
init {
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>foo<!>()
}
}
val x = <!ILLEGAL_SUSPEND_FUNCTION_CALL!>foo<!>()
@@ -0,0 +1,12 @@
package
public val x: kotlin.Unit
public suspend fun foo(): kotlin.Unit
public fun noSuspend(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}