Implement coroutineContext intrinsic
This intrinsic allows coroutine to access its context without suspention and, furthermore, disabling tail-call optimization. KT-17609: Fixed
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.coroutines.experimental.intrinsics.coroutineContext
|
||||
import kotlin.coroutines.experimental.CoroutineContext
|
||||
|
||||
fun ordinal() {
|
||||
<!ILLEGAL_SUSPEND_PROPERTY_ACCESS!>coroutineContext<!>
|
||||
}
|
||||
|
||||
suspend fun named() {
|
||||
coroutineContext
|
||||
}
|
||||
|
||||
class A {
|
||||
val coroutineContext = kotlin.coroutines.experimental.intrinsics.<!ILLEGAL_SUSPEND_PROPERTY_ACCESS!>coroutineContext<!>
|
||||
}
|
||||
|
||||
class Controller {
|
||||
fun ordinal() {
|
||||
<!ILLEGAL_SUSPEND_PROPERTY_ACCESS!>coroutineContext<!>
|
||||
}
|
||||
|
||||
suspend fun named() {
|
||||
coroutineContext
|
||||
}
|
||||
|
||||
suspend fun severalArgs(s: String, a: Any) {
|
||||
coroutineContext
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: () -> CoroutineContext) = {}
|
||||
fun builderSuspend(c: suspend () -> CoroutineContext) = {}
|
||||
|
||||
fun builderSeveralArgs(c: (Int, Int, Int) -> CoroutineContext) = {}
|
||||
fun builderSuspendSeveralArgs(c: suspend (Int, Int, Int) -> CoroutineContext) = {}
|
||||
|
||||
fun test() {
|
||||
builder { <!ILLEGAL_SUSPEND_PROPERTY_ACCESS!>coroutineContext<!> }
|
||||
builderSuspend { coroutineContext }
|
||||
builderSeveralArgs {_, _,_ -> <!ILLEGAL_SUSPEND_PROPERTY_ACCESS!>coroutineContext<!> }
|
||||
builderSuspendSeveralArgs {_, _,_ -> coroutineContext}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
public fun builder(/*0*/ c: () -> kotlin.coroutines.experimental.CoroutineContext): () -> kotlin.Unit
|
||||
public fun builderSeveralArgs(/*0*/ c: (kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.coroutines.experimental.CoroutineContext): () -> kotlin.Unit
|
||||
public fun builderSuspend(/*0*/ c: suspend () -> kotlin.coroutines.experimental.CoroutineContext): () -> kotlin.Unit
|
||||
public fun builderSuspendSeveralArgs(/*0*/ c: suspend (kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.coroutines.experimental.CoroutineContext): () -> kotlin.Unit
|
||||
public suspend fun named(): kotlin.Unit
|
||||
public fun ordinal(): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public final val coroutineContext: kotlin.coroutines.experimental.CoroutineContext
|
||||
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
|
||||
}
|
||||
|
||||
public final class Controller {
|
||||
public constructor Controller()
|
||||
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 final suspend fun named(): kotlin.Unit
|
||||
public final fun ordinal(): kotlin.Unit
|
||||
public final suspend fun severalArgs(/*0*/ s: kotlin.String, /*1*/ a: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user