Fix tests: "infix modifier required" and "operator modifier required" errors
This commit is contained in:
@@ -3,10 +3,10 @@ fun foo(f: (Int?) -> Int): Int {
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
fun Int?.plus(a:Int) : Int = a!! + 2
|
||||
infix operator fun Int?.plus(a: Int) : Int = a!! + 2
|
||||
|
||||
if (foo { it + 1} != 3) return "Fail 1"
|
||||
if (foo { it plus 1} != 3) return "Fail 2"
|
||||
if (foo { it + 1 } != 3) return "Fail 1"
|
||||
if (foo { it plus 1 } != 3) return "Fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fun box(): String {
|
||||
fun Int.foo(a: Int): Int = a + 2
|
||||
infix fun Int.foo(a: Int): Int = a + 2
|
||||
|
||||
val s = object {
|
||||
fun test(): Int {
|
||||
|
||||
@@ -3,7 +3,7 @@ class T(val value: Int) {
|
||||
|
||||
fun local() : Int {
|
||||
|
||||
fun T.get(s: Int): Int {
|
||||
operator fun T.get(s: Int): Int {
|
||||
return s * this.value
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
open class T(var value: Int) {}
|
||||
|
||||
fun plusAssign(): T {
|
||||
operator fun plusAssign(): T {
|
||||
|
||||
fun T.plusAssign(s: Int) {
|
||||
operator fun T.plusAssign(s: Int) {
|
||||
value += s
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ fun box(): String {
|
||||
|
||||
|
||||
fun selectMetaRunnerId(): String {
|
||||
fun Int?.inc() = (this ?: 0) + 1
|
||||
operator fun Int?.inc() = (this ?: 0) + 1
|
||||
var counter: Int? = null
|
||||
fun path(metaRunnerId: String) = counter != 2
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Z {}
|
||||
|
||||
fun box(): String {
|
||||
fun Z.plus(s : String, d : String = "K") : String {
|
||||
operator fun Z.plus(s : String, d : String = "K") : String {
|
||||
return s + d
|
||||
}
|
||||
return Z() + "O"
|
||||
|
||||
Reference in New Issue
Block a user