mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 08:31:35 +00:00
* The members of Result are isSuccess, isFailure, exceptionOrNull, getOrNull * The rest of API is implemented via inline-only extensions * There are two internal functions to hide detailed mechanics of an internal Result.Failure class: createFailure and throwOnFailure * Result.toString is explicit: either Success(v) or Failure(x) See KT-26538
17 lines
413 B
Kotlin
Vendored
17 lines
413 B
Kotlin
Vendored
// LANGUAGE_VERSION: 1.3
|
|
// WITH_RUNTIME
|
|
// TREAT_AS_ONE_FILE
|
|
import kotlin.coroutines.*
|
|
import kotlin.coroutines.intrinsics.*
|
|
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
|
x.resumeWith(Result.success("OK"))
|
|
}
|
|
|
|
suspend fun suspendThere(param: Int, param2: String, param3: Long): String {
|
|
val a = suspendHere()
|
|
val b = suspendHere()
|
|
return a + b
|
|
}
|
|
|
|
// 1 ASTORE 4
|