Adjust various testData to remove/charAt transformation

This commit is contained in:
Denis Zharkov
2015-10-11 12:40:39 +03:00
parent 6d864e0854
commit a76a8fcc3f
20 changed files with 30 additions and 30 deletions
@@ -14,7 +14,7 @@ class MyList<T>(val v: T): List<T> {
override fun equals(other: Any?): Boolean = false
public fun add(e: T): Boolean = true
public fun remove(o: Any?): Boolean = true
public fun remove(o: T): Boolean = true
public fun addAll(c: Collection<T>): Boolean = true
public fun addAll(index: Int, c: Collection<T>): Boolean = true
public fun removeAll(c: Collection<Any?>): Boolean = true
@@ -22,7 +22,7 @@ class MyList<T>(val v: T): List<T> {
public fun clear() {}
public fun set(index: Int, element: T): T = element
public fun add(index: Int, element: T) {}
public fun remove(index: Int): T = v
public fun removeAt(index: Int): T = v
}
fun box(): String {
@@ -1,6 +1,6 @@
open class Super<T>(val v: T) {
public fun add(e: T): Boolean = true
public fun remove(o: Any?): Boolean = true
public fun remove(o: T): Boolean = true
public fun addAll(c: Collection<T>): Boolean = true
public fun addAll(index: Int, c: Collection<T>): Boolean = true
public fun removeAll(c: Collection<Any?>): Boolean = true
@@ -8,7 +8,7 @@ open class Super<T>(val v: T) {
public fun clear() {}
public fun set(index: Int, element: T): T = element
public fun add(index: Int, element: T) {}
public fun remove(index: Int): T = v
public fun removeAt(index: Int): T = v
}
class MyList<T>(v: T): Super<T>(v), List<T> {
@@ -17,7 +17,7 @@ fun box(): String {
a.add("")
a.set(0, "")
a.add(0, "")
a.remove(0)
a.removeAt(0)
a.remove("")
return "OK"
@@ -1,6 +1,6 @@
open class SetStringImpl {
fun add(s: String): Boolean = false
fun remove(o: Any?): Boolean = false
fun remove(o: String): Boolean = false
fun clear(): Unit {}
}
@@ -22,7 +22,7 @@ class A1 : MutableCollection<String> {
throw UnsupportedOperationException()
}
override fun remove(o: Any?): Boolean {
override fun remove(o: String): Boolean {
throw UnsupportedOperationException()
}
+1 -1
View File
@@ -1,4 +1,4 @@
fun StringBuilder.first() = this.charAt(0)
fun StringBuilder.first() = this.get(0)
fun foo() = StringBuilder("foo").first()
@@ -1,6 +1,6 @@
fun StringBuilder.takeFirst(): Char {
if (this.length() == 0) return 0.toChar()
val c = this.charAt(0)
val c = this.get(0)
this.deleteCharAt(0)
return c
}
+1 -1
View File
@@ -1,5 +1,5 @@
fun box(): String {
val o = "OK" charAt 0
val o = "OK" get 0
val array = CharArray(2)
array[1] = 'K'
val k = array get 1
+1 -1
View File
@@ -1,7 +1,7 @@
// KT-5956 java.lang.AbstractMethodError: test.Thing.subSequence(II)Ljava/lang/CharSequence
class Thing(val delegate: CharSequence) : CharSequence {
override fun charAt(index: Int): Char {
override fun get(index: Int): Char {
throw UnsupportedOperationException()
}
override fun length(): Int = 0
@@ -3,7 +3,7 @@ open class KList<E> : MutableList<E> {
throw UnsupportedOperationException()
}
override fun remove(o: Any?): Boolean {
override fun remove(o: E): Boolean {
throw UnsupportedOperationException()
}
@@ -35,7 +35,7 @@ open class KList<E> : MutableList<E> {
throw UnsupportedOperationException()
}
override fun remove(index: Int): E {
override fun removeAt(index: Int): E {
throw UnsupportedOperationException()
}
@@ -29,7 +29,7 @@ open class KList : MutableList<String> {
throw UnsupportedOperationException()
}
override fun remove(o: Any?): Boolean {
override fun remove(o: String): Boolean {
throw UnsupportedOperationException()
}
@@ -61,7 +61,7 @@ open class KList : MutableList<String> {
throw UnsupportedOperationException()
}
override fun remove(index: Int): String {
override fun removeAt(index: Int): String {
throw UnsupportedOperationException()
}