Overloading operations via extension functions.

Also inline useless TranslationUtils#zeroLiteral. Eliminate dead code.
This commit is contained in:
Pavel V. Talanov
2012-07-19 20:40:03 +04:00
parent 36184ded3b
commit 803be4b0d5
9 changed files with 110 additions and 53 deletions
@@ -0,0 +1,16 @@
package foo
import java.util.*
fun <T> ArrayList<T>.plusAssign(other: Collection<T>) {
addAll(other)
}
fun box(): Boolean {
var v1 = ArrayList<String>()
val v2 = ArrayList<String>()
v1.add("foo")
v2.add("bar")
v1 += v2
return (v1.size() == 2 && v1[0] == "foo" && v1[1] == "bar")
}