Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/properties/kt4340.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

36 lines
601 B
Kotlin

class A {
var result: Int = 0;
private val Int.times3: Int
get() = this * 3
private var Int.times: Int
get() = this * 4
set(s: Int) {
result = this * s
}
fun test(p: Int):Int {
return {
p.times3
}()
}
fun test2(p: Int, s: Int):Int {
{
p.times = s
}()
return result
}
}
fun box() : String {
var result = A().test(3);
if (result != 9) return "fail1: $result"
result = A().test2(2, 4);
if (result != 8) return "fail2: $result"
return "OK"
}