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 -1
View File
@@ -1,6 +1,6 @@
fun box(): String {
val sb = StringBuilder()
fun String.plus() {
operator fun String.unaryPlus() {
sb.append(this)
}
@@ -1,7 +1,7 @@
class A {
private val sb: StringBuilder = StringBuilder()
fun String.plus() {
operator fun String.unaryPlus() {
sb.append(this)
}
+1 -1
View File
@@ -2,7 +2,7 @@ var result = ""
fun result(r: String) { result = r }
object Foo {
private fun String.plus() = "(" + this + ")"
private operator fun String.unaryPlus() = "(" + this + ")"
fun foo() = { result(+"Stuff") }()
}
+1 -1
View File
@@ -2,7 +2,7 @@ var result = "Fail"
class A
fun A.inc(s: String = "OK"): A {
operator fun A.inc(s: String = "OK"): A {
result = s
return this
}
+2 -2
View File
@@ -3,8 +3,8 @@ import java.util.*
class Template() {
val collected = ArrayList<String>()
fun String.plus() {
collected.add(this@plus)
operator fun String.unaryPlus() {
collected.add(this@unaryPlus)
}
fun test() {
+1 -1
View File
@@ -1,4 +1,4 @@
fun <T> T.mustBe(t : T) {
infix fun <T> T.mustBe(t : T) {
assert("$this must be $t") {this == t}
}