Files
kotlin-fork/idea/testData/codegen/classes/extensionClosure.jet
T
Andrey Breslav e0d597a1bc JET-140 Change function type syntax
and tests for
JET-168 Improve the parser for function and tuple types as receiver types
2011-07-06 18:18:11 +04:00

14 lines
335 B
Plaintext

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 : fun Point.(scalar : Int) : Point) : Point {
return arg.f(2)
}