Fix tests: "infix modifier required" and "operator modifier required" errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class MyNumber(val i: Int) {
|
||||
fun inc(): MyNumber = MyNumber(i+1)
|
||||
operator fun inc(): MyNumber = MyNumber(i+1)
|
||||
}
|
||||
|
||||
class MNR(var ref: MyNumber) {}
|
||||
@@ -53,12 +53,12 @@ fun test6() : Boolean {
|
||||
class MyArrayList<T>() {
|
||||
private var value17: T? = null
|
||||
private var value39: T? = null
|
||||
fun get(index: Int): T {
|
||||
operator fun get(index: Int): T {
|
||||
if (index == 17) return value17!!
|
||||
if (index == 39) return value39!!
|
||||
throw Exception()
|
||||
}
|
||||
fun set(index: Int, value: T): T? {
|
||||
operator fun set(index: Int, value: T): T? {
|
||||
if (index == 17) value17 = value
|
||||
else if (index == 39) value39 = value
|
||||
else throw Exception()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class mInt(val i : Int) {
|
||||
override fun toString() : String = "mint: $i"
|
||||
fun plus(i : Int) = mInt(this.i + i)
|
||||
fun inc() = mInt(i + 1)
|
||||
operator fun plus(i : Int) = mInt(this.i + i)
|
||||
operator fun inc() = mInt(i + 1)
|
||||
}
|
||||
|
||||
class MyArray() {
|
||||
val a = Array<mInt>(10, {mInt(0)})
|
||||
fun get(i : mInt) : mInt = a[i.i]
|
||||
fun set(i : mInt, v : mInt) {
|
||||
operator fun get(i : mInt) : mInt = a[i.i]
|
||||
operator fun set(i : mInt, v : mInt) {
|
||||
a[i.i] = v
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user