Implement hack to support both remove() and removeAt() in MutableList<Int>

Also add couple of tests about CharSequence.get
This commit is contained in:
Denis Zharkov
2015-10-10 20:49:18 +03:00
parent 742a538aed
commit 89ded4ab1d
10 changed files with 320 additions and 1 deletions
@@ -0,0 +1,28 @@
open class A : CharSequence {
override fun length(): Int {
throw UnsupportedOperationException()
}
override fun get(index: Int) = 'z';
override fun subSequence(start: Int, end: Int): CharSequence {
throw UnsupportedOperationException()
}
}
fun box(): String {
val b = J.B()
val a = A()
if (b[0] != 'z') return "fail 6"
if (a[0] != 'z') return "fail 7"
if (b[1] != 'a') return "fail 8"
if (a[0] != 'z') return "fail 9"
if (b.get(0) != 'z') return "fail 10"
if (a.get(0) != 'z') return "fail 11"
if (b.get(1) != 'a') return "fail 12"
if (a.get(1) != 'z') return "fail 13"
return J.foo();
}