diff --git a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt b/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt deleted file mode 100644 index 25244e4d07a..00000000000 --- a/compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt +++ /dev/null @@ -1,31 +0,0 @@ -// WITH_RUNTIME -class A { - operator fun component1() = "O" - operator fun component2(): String = throw RuntimeException("fail 0") - operator fun component3() = "K" -} - -suspend fun foo(a: A, block: suspend (A) -> String): String = block(a) - -suspend fun test() = foo(A()) { (x_param, _, y_param) -> - x_param + y_param -} - -// Parameters (including anonymous destructuring parameters) are moved to fields in the Continuation class for the suspend lambda class. -// However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). -// In IR, the fields are directly read from. - -// METHOD : UnderscoreNamesKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; - -// JVM_TEMPLATES -// VARIABLE : NAME=$dstr$x_param$_u24__u24$y_param TYPE=LA; INDEX=2 -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=4 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 diff --git a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt index d654a083455..728452ff7c3 100644 --- a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt @@ -17,36 +17,50 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> // However, in non-IR, the fields are first stored in local variables, and they are not read directly (even for destructuring components). // In IR, the fields are directly read from. -// METHOD : UnderscoreNamesKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; +// The local variable for destructuring suspend lambda arguments, in this case +// `$dstr$x_param$_u24__u24$y_param`, is moved to a field in the IR backend, +// so does not figure in the LVT. -// JVM_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=4 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// JVM_IR_TEMPLATES -// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=2 -// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=3 -// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0 -// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1 - -// IGNORE_BACKEND: JVM_IR // LOCAL VARIABLES // test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:4 : // test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // CoroutineUtil.kt:28 getContext: + +// LOCAL VARIABLES JVM // test.kt:-1 : // test.kt:-1 create: value:java.lang.Object=A, completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:-1 invoke: + +// LOCAL VARIABLES JVM_IR +// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:-1 create: value:java.lang.Object=A, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=helpers.ResultContinuation + +// LOCAL VARIABLES // test.kt:12 invokeSuspend: // test.kt:5 component1: + +// LOCAL VARIABLES JVM // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A // test.kt:7 component3: // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A + +// LOCAL VARIABLES JVM_IR +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit +// test.kt:7 component3: +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String + +// LOCAL VARIABLES // test.kt:13 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String, y_param:java.lang.String="K":java.lang.String + +// LOCAL VARIABLES JVM // test.kt:-1 invoke: + +// LOCAL VARIABLES JVM_IR +// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=helpers.ResultContinuation + +// LOCAL VARIABLES // test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation // test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java index eb4e6c9fd13..45d7ff1000d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java @@ -188,10 +188,5 @@ public class CheckLocalVariablesTableTestGenerated extends AbstractCheckLocalVar public void testParameters() throws Exception { runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt"); } - - @TestMetadata("underscoreNames.kt") - public void testUnderscoreNames() throws Exception { - runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt"); - } } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java index 18a8246b391..fe853f1f52b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCheckLocalVariablesTableTestGenerated.java @@ -188,10 +188,5 @@ public class IrCheckLocalVariablesTableTestGenerated extends AbstractIrCheckLoca public void testParameters() throws Exception { runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt"); } - - @TestMetadata("underscoreNames.kt") - public void testUnderscoreNames() throws Exception { - runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/underscoreNames.kt"); - } } }