K1/K2: add BB test for (add/remove)(First/Last) calls on mutable list

Related to KT-64640
This commit is contained in:
Mikhail Glukhikh
2024-01-02 13:15:44 +01:00
committed by Space Team
parent 940c3c81ad
commit 8c2f5c767f
10 changed files with 137 additions and 0 deletions
@@ -0,0 +1,20 @@
// TARGET_BACKEND: JVM_IR
fun foo(x: MutableList<String>) {
x.addFirst("1")
x.addLast("2")
}
fun bar(x: MutableList<String>) {
x.removeFirst()
x.removeLast()
}
fun box(): String {
val list = mutableListOf("OK")
foo(list)
if (list.first() != "1") return "FAIL 1"
if (list.last() != "2") return "FAIL 2"
bar(list)
return list.single()
}