Files
kotlin-fork/compiler/testData/codegen/box/classes/kt1726.kt
T
2018-06-28 12:26:41 +02:00

17 lines
310 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
class Foo(
var state : Int,
val f : (Int) -> Int){
fun next() : Int {
val nextState = f(state)
state = nextState
return state
}
}
fun box(): String {
val f = Foo(23, {x -> 2 * x})
return if (f.next() == 46) "OK" else "fail"
}