23 lines
458 B
Kotlin
Vendored
23 lines
458 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
|
|
|
|
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
|
@kotlin.jvm.JvmInline
|
|
value class Result<T>(val isSuccess: Boolean)
|
|
|
|
fun interface ResultHandler<T> {
|
|
fun onResult(result: Result<T>)
|
|
}
|
|
|
|
fun doSmth(resultHandler: ResultHandler<Boolean>) {
|
|
resultHandler.onResult(Result(true))
|
|
}
|
|
|
|
fun box(): String {
|
|
var res = "FAIL"
|
|
doSmth { result ->
|
|
res = if (result.isSuccess) "OK" else "FAIL 1"
|
|
}
|
|
return res
|
|
}
|