K1/K2: add BB test for (add/remove)(First/Last) calls on mutable list
Related to KT-64640
This commit is contained in:
committed by
Space Team
parent
940c3c81ad
commit
8c2f5c767f
+20
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user