[IR] More extensive LVT tests around destructuring

All tests in this commit _pass_ to document existing behavior, but
this will change in a separate commit as we reflect desired behavior
in the test expectations.
This commit is contained in:
Kristoffer Andersen
2022-03-01 12:37:14 +01:00
committed by Alexander Udalov
parent 9b44c73f54
commit b81139ad36
19 changed files with 843 additions and 62 deletions
@@ -0,0 +1,48 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: test.kt
data class A(val x: String, val y: Int)
fun foo(a: A, block: (A) -> String): String = block(a)
fun box() {
foo(A("O", 123))
{
(
x
,
y
)
->
x + y
}
return
}
// EXPECTATIONS
// EXPECTATIONS JVM
// test.kt:9 box:
// test.kt:4 <init>: x:java.lang.String="O":java.lang.String, y:int=123:int
// test.kt:10 box:
// test.kt:9 box:
// test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:17 invoke: $dstr$x$y:A=A
// test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:9 box:
// test.kt:20 box:
// EXPECTATIONS JVM_IR
// test.kt:9 box:
// test.kt:4 <init>: x:java.lang.String="O":java.lang.String, y:int=123:int
// test.kt:9 box:
// test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:11 invoke:
// test.kt:12 invoke:
// test.kt:11 invoke: x:java.lang.String="O":java.lang.String
// test.kt:14 invoke: x:java.lang.String="O":java.lang.String
// test.kt:17 invoke: x:java.lang.String="O":java.lang.String, y:int=123:int
// test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:9 box:
// test.kt:20 box: