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
@@ -1,20 +1,20 @@
package foo
class A(val value: Int) : Comparable<A> {
override public fun compareTo(other: A): Int = other.value compareTo value
override public fun compareTo(other: A): Int = other.value.compareTo(value)
}
class B(val value: Int)
fun testExtensionFunctionAsCompareTo() {
val compareTo: B.( B ) -> Int = { other -> other.value compareTo this.value }
val compareTo: B.( B ) -> Int = { other -> other.value.compareTo(this.value) }
val x: B = B(100)
val y: B = B(200)
assertEquals(false, x < y, "ext fun: x < y")
assertEquals(true, x > y, "ext fun: x > y")
assertEquals(1, x compareTo y, "ext fun: x compareTo y")
assertEquals(1, x.compareTo(y), "ext fun: x compareTo y")
}
fun testMethodAsCompareTo() {
@@ -23,12 +23,12 @@ fun testMethodAsCompareTo() {
assertEquals(false, x < y, "meth: x < y")
assertEquals(true, x > y, "meth: x > y")
assertEquals(1, x compareTo y, "meth: x compareTo y")
assertEquals(1, x.compareTo(y), "meth: x compareTo y")
val comparable: Comparable<A> = x
assertEquals(false, comparable < y, "meth: (x: Comparable<A>) < y")
assertEquals(true, comparable > y, "meth: (x: Comparable<A>) > y")
assertEquals(1, comparable compareTo y, "meth: (x: Comparable<A>) compareTo y")
assertEquals(1, comparable.compareTo(y), "meth: (x: Comparable<A>) compareTo y")
}
fun box(): String {