Fix tests: "infix modifier required" and "operator modifier required" errors

This commit is contained in:
Yan Zhulanow
2015-11-26 15:56:56 +03:00
parent a3ff3ffc45
commit 9d1af5a17e
635 changed files with 1283 additions and 1617 deletions
@@ -7,7 +7,7 @@ class A {
}
object NumberDecrypter {
fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) {
operator fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) {
"four" -> 4
"two" -> 2
else -> throw AssertionError()
@@ -5,11 +5,11 @@ var result: String by Delegate
object Delegate {
var value = "lol"
fun getValue(instance: Any?, data: KProperty<*>): String {
operator fun getValue(instance: Any?, data: KProperty<*>): String {
return value
}
fun setValue(instance: Any?, data: KProperty<*>, newValue: String) {
operator fun setValue(instance: Any?, data: KProperty<*>, newValue: String) {
value = newValue
}
}
@@ -10,7 +10,7 @@ val <T> Value<T>.additionalText by DVal(Value<T>::text) //works
val <T> Value<T>.additionalValue by DVal(Value<T>::value) //not work
class DVal<T, R, P: KProperty1<T, R>>(val kmember: P) {
fun getValue(t: T, p: KProperty<*>): R {
operator fun getValue(t: T, p: KProperty<*>): R {
return kmember.get(t)
}
}
@@ -4,7 +4,7 @@ val String.id: String
fun box(): String {
val pr = String::id
if (pr["123"] != "123") return "Fail value: ${pr["123"]}"
if (pr.get("123") != "123") return "Fail value: ${pr.get("123")}"
if (pr.name != "id") return "Fail name: ${pr.name}"
@@ -10,9 +10,9 @@ var Int.foo: Int
fun box(): String {
val pr = Int::foo
if (pr.get(42) != 42) return "Fail 1: ${pr[42]}"
if (pr.get(42) != 42) return "Fail 1: ${pr.get(42)}"
pr.set(200, 39)
if (pr.get(-239) != 0) return "Fail 2: ${pr[-239]}"
if (pr.get(-239) != 0) return "Fail 2: ${pr.get(-239)}"
if (storage != 239) return "Fail 3: $storage"
return "OK"
}
@@ -4,9 +4,9 @@ fun box(): String {
val o = Box("lorem")
val prop = Box::value
if (prop.get(o) != "lorem") return "Fail 1: ${prop[o]}"
if (prop.get(o) != "lorem") return "Fail 1: ${prop.get(o)}"
prop.set(o, "ipsum")
if (prop.get(o) != "ipsum") return "Fail 2: ${prop[o]}"
if (prop.get(o) != "ipsum") return "Fail 2: ${prop.get(o)}"
if (o.value != "ipsum") return "Fail 3: ${o.value}"
o.value = "dolor"
if (prop.get(o) != "dolor") return "Fail 4: ${prop.get(o)}"