Files
kotlin/compiler/testData/codegen/bytecodeText/builtinFunctions/removeAt.kt
Denis Zharkov 89ded4ab1d Implement hack to support both remove() and removeAt() in MutableList<Int>
Also add couple of tests about CharSequence.get
2015-10-11 19:57:22 +03:00

117 lines
3.0 KiB
Kotlin
Vendored

abstract class A1<T> : MutableList<T> {
override fun remove(x: T): Boolean = true
override fun removeAt(index: Int): T = null!!
}
abstract class A2 : MutableList<String> {
override fun remove(x: String): Boolean = true
override fun removeAt(index: Int): String = null!!
}
abstract class A3 : java.util.AbstractList<String>() {
override fun remove(x: String): Boolean = true
override fun removeAt(index: Int): String = null!!
}
abstract class A4 : java.util.AbstractList<String>() {
override abstract fun remove(x: String): Boolean
override abstract fun removeAt(index: Int): String
}
abstract class A5 : java.util.ArrayList<String>() {
override fun remove(x: String): Boolean = true
override fun removeAt(index: Int): String = null!!
}
abstract class A6 : java.util.ArrayList<String>() {
override abstract fun remove(x: String): Boolean
override abstract fun removeAt(index: Int): String
}
abstract class A7 : MutableList<String>
abstract class A8 : java.util.ArrayList<String>()
interface A9 : MutableList<String> {}
abstract class A10 : MutableList<Int> {
override fun remove(x: Int): Boolean = true
override fun removeAt(index: Int): Int = 1
}
fun box(
a1: A1<String>,
a2: A2,
a3: A3,
a4: A4,
a5: A5,
a6: A6,
a7: A7,
a8: A8,
a9: A9,
a10: A10,
c1: MutableList<String>,
c2: MutableList<Int>
) {
a1.removeAt(1)
a1.remove("")
a2.removeAt(1)
a2.remove("")
a3.removeAt(1)
a3.remove("")
a4.removeAt(1)
a4.remove("")
a5.removeAt(1)
a5.remove("")
a6.removeAt(1)
a6.remove("")
a7.removeAt(1)
a7.remove("")
a8.removeAt(1)
a8.remove("")
a9.removeAt(1)
a9.remove("")
a10.removeAt(1)
a10.remove(2)
c1.removeAt(1)
c1.remove("")
c2.removeAt(1)
c2.remove(2)
}
/*
9 public final bridge remove\(I\) -> Bridges for removeAt from A2-A10
7 public synthetic bridge remove\(I\)Ljava/lang/Object; -> Synthetic bridges from A2-A9
16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in bridges
1 public remove\(Ljava/lang/Integer;\)Z -> implementation in A10
3 public abstract removeAt\(I\) -> A4, A6, A7
1 INVOKEINTERFACE A9\.remove \(I\) -> call A9.removeAt
1 INVOKEINTERFACE A9\.remove \(Ljava/lang/Object;\) -> call A9.remove
9 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt
*/
// 9 public final bridge remove\(I\)
// 7 public synthetic bridge remove\(I\)Ljava/lang/Object;
// 1 public remove\(Ljava/lang/Integer;\)Z
// 3 public abstract removeAt\(I\)
// 16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
// 1 INVOKEINTERFACE A9\.remove \(I\)
// 1 INVOKEINTERFACE A9\.remove \(Ljava/lang/Object;\)
// 9 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 1 INVOKEVIRTUAL A10\.remove \(I\)
// 9 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 1 INVOKEVIRTUAL A10\.remove \(I\)
// 2 INVOKEINTERFACE java\/util\/List.remove \(I\)
// 2 INVOKEINTERFACE java\/util\/List.remove \(Ljava/lang/Object;\)