Files
kotlin-fork/compiler/testData/codegen/box/closures/extensionClosure.kt
T
Alexander Udalov 41a416da60 Move blackBoxFile() testData to box/ directory
Delete all test methods (and empty test classes), since they'll be
auto-generated
2013-01-28 18:20:17 +04:00

14 lines
333 B
Kotlin

class Point(val x : Int, val y : Int)
fun box() : String {
val answer = apply(Point(3, 5), { Point.(scalar : Int) : Point ->
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)
}