Fix tests: "infix modifier required" and "operator modifier required" errors
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package foo
|
||||
|
||||
class A {
|
||||
fun component1(): Int = 1
|
||||
operator fun component1(): Int = 1
|
||||
}
|
||||
fun A.component2(): String = "n"
|
||||
operator fun A.component2(): String = "n"
|
||||
|
||||
fun box(): String {
|
||||
val list = Array<A>(1, { A() })
|
||||
|
||||
@@ -3,18 +3,18 @@ package foo
|
||||
import java.util.HashMap
|
||||
|
||||
|
||||
public fun <K, V> Map<K, V>.iterator(): Iterator<Map.Entry<K, V>> {
|
||||
operator fun <K, V> Map<K, V>.iterator(): Iterator<Map.Entry<K, V>> {
|
||||
val entrySet = this.entrySet()
|
||||
return entrySet.iterator()
|
||||
}
|
||||
|
||||
/** Returns the key of the entry */
|
||||
fun <K, V> Map.Entry<K, V>.component1(): K {
|
||||
operator fun <K, V> Map.Entry<K, V>.component1(): K {
|
||||
return getKey()
|
||||
}
|
||||
|
||||
/** Returns the value of the entry */
|
||||
fun <K, V> Map.Entry<K, V>.component2(): V {
|
||||
operator fun <K, V> Map.Entry<K, V>.component2(): V {
|
||||
return getValue()
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ fun ComparableRange<C>.iterator(): Iterator<C> {
|
||||
}
|
||||
|
||||
open class A {
|
||||
fun component1(): Int = 1
|
||||
operator fun component1(): Int = 1
|
||||
}
|
||||
fun A.component2(): String = "n"
|
||||
operator fun A.component2(): String = "n"
|
||||
|
||||
fun box(): String {
|
||||
var i = 0;
|
||||
|
||||
@@ -3,9 +3,9 @@ package foo
|
||||
import java.util.ArrayList
|
||||
|
||||
class A {
|
||||
fun component1(): Int = 1
|
||||
operator fun component1(): Int = 1
|
||||
}
|
||||
fun A.component2(): String = "n"
|
||||
operator fun A.component2(): String = "n"
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList<A>()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package foo
|
||||
|
||||
fun Int.component1(): Int {
|
||||
operator fun Int.component1(): Int {
|
||||
return this + 10;
|
||||
}
|
||||
|
||||
fun Int.component2(): String = "b"
|
||||
operator fun Int.component2(): String = "b"
|
||||
|
||||
fun box(): String {
|
||||
var i = 0;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package foo
|
||||
|
||||
fun Int.component1(): Int {
|
||||
operator fun Int.component1(): Int {
|
||||
return this + 10;
|
||||
}
|
||||
|
||||
fun Int.component2(): String = "b"
|
||||
operator fun Int.component2(): String = "b"
|
||||
|
||||
fun box(): String {
|
||||
var i = 0;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package foo
|
||||
|
||||
class A {
|
||||
fun component1(): Int = 1
|
||||
operator fun component1(): Int = 1
|
||||
}
|
||||
fun A.component2(): String = "n"
|
||||
operator fun A.component2(): String = "n"
|
||||
|
||||
class B {
|
||||
fun component1(): Int = 1
|
||||
fun component2(): Int = 2
|
||||
fun component3(): Int = 3
|
||||
operator fun component1(): Int = 1
|
||||
operator fun component2(): Int = 2
|
||||
operator fun component3(): Int = 3
|
||||
}
|
||||
|
||||
class C {
|
||||
fun component1(): Int = 42
|
||||
operator fun component1(): Int = 42
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
Reference in New Issue
Block a user