Files
kotlin-fork/js/js.translator/testData/box/operatorOverloading/prefixDecOverload.kt
T
2016-09-29 12:00:41 +03:00

18 lines
249 B
Kotlin
Vendored

package foo
class MyInt() {
var b = 0
operator fun dec(): MyInt {
val res = MyInt()
res.b++;
return res;
}
}
fun box(): String {
var c = MyInt()
--c;
return if (c.b == 1) "OK" else "fail: ${c.b}"
}