Files
kotlin-fork/compiler/testData/codegen/box/closures/extensionClosure.kt
T
2019-11-19 11:00:09 +03:00

15 lines
347 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
class Point(val x : Int, val y : Int)
fun box() : String {
val answer = apply(Point(3, 5), { scalar : Int ->
Point(x * scalar, y * scalar)
})
return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL"
}
fun apply(arg:Point, f : Point.(scalar : Int) -> Point) : Point {
return arg.f(2)
}