mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
31 lines
643 B
Kotlin
Vendored
31 lines
643 B
Kotlin
Vendored
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
|
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// WITH_RUNTIME
|
|
|
|
fun interface MyRunnable {
|
|
fun invoke()
|
|
}
|
|
|
|
class A {
|
|
inline fun doWork(noinline job: () -> Unit) {
|
|
MyRunnable(job).invoke()
|
|
}
|
|
|
|
fun doNoninlineWork(job: () -> Unit) {
|
|
MyRunnable(job).invoke()
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
var result = false
|
|
A().doWork { result = true }
|
|
if (!result) return "Fail 1"
|
|
|
|
result = false
|
|
A().doNoninlineWork { result = true }
|
|
if (!result) return "Fail 2"
|
|
|
|
return "OK"
|
|
}
|