Files
kotlin-fork/compiler/testData/codegen/box/jvmStatic/kt9897_static.kt
T
Ilya Matveev a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00

47 lines
889 B
Kotlin
Vendored

// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_RUNTIME
object Test {
var z = "0"
var l = 0L
fun changeObject(): String {
"1".someProperty += 1
return z
}
fun changeLong(): Long {
2L.someProperty -= 1
return l
}
@JvmStatic var String.someProperty: Int
get() {
return this.length
}
set(left) {
z += this + left
}
@JvmStatic var Long.someProperty: Long
get() {
return l
}
set(left) {
l += this + left
}
}
fun box(): String {
val changeObject = Test.changeObject()
if (changeObject != "012") return "fail 1: $changeObject"
val changeLong = Test.changeLong()
if (changeLong != 1L) return "fail 1: $changeLong"
return "OK"
}