[JVM+IR] Migrate/improve receiver mangling test suite

This commit is contained in:
Kristoffer Andersen
2020-11-04 13:12:37 +01:00
committed by max-kammerer
parent 5967e8295e
commit edd3b457d4
15 changed files with 181 additions and 60 deletions
@@ -1,3 +0,0 @@
class Foo {
inner class Bar
}
@@ -1,9 +0,0 @@
public final class Foo$Bar : java/lang/Object {
final Foo this$0
public void <init>(Foo this$0)
}
public final class Foo : java/lang/Object {
public void <init>()
}
@@ -1 +0,0 @@
fun String.foo(a: Int) {}
@@ -1,3 +0,0 @@
public final class SimpleKt : java/lang/Object {
public final static void foo(java.lang.String $this$foo, int a)
}
@@ -0,0 +1,21 @@
// FILE: test.kt
class Foo {
inner class Bar {
}
}
fun box() {
val x = Foo()
x.Bar()
}
// LOCAL VARIABLES
// test.kt:10 box:
// test.kt:4 <init>:
// test.kt:10 box:
// test.kt:11 box: x:Foo=Foo
// test.kt:5 <init>:
// test.kt:11 box: x:Foo=Foo
// test.kt:12 box: x:Foo=Foo
@@ -0,0 +1,19 @@
// FILE: test.kt
fun blockFun(blockArg: String.() -> Unit) =
"OK".blockArg()
fun box() {
blockFun {
println(this)
}
}
// LOCAL VARIABLES
// test.kt:8 box:
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String
// test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:11 box:
@@ -0,0 +1,19 @@
// FILE: test.kt
fun blockFun(blockArg: String.() -> Unit) =
"OK".blockArg()
fun box() {
blockFun {
println(this)
}
}
// LOCAL VARIABLES
// test.kt:8 box:
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String
// test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:11 box:
@@ -0,0 +1,19 @@
// FILE: test.kt
fun blockFun(blockArg: String.() -> Unit) =
"OK".blockArg()
fun box() {
blockFun label@{
println(this)
}
}
// LOCAL VARIABLES
// test.kt:8 box:
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:9 invoke: $this$label:java.lang.String="OK":java.lang.String
// test.kt:10 invoke: $this$label:java.lang.String="OK":java.lang.String
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:11 box:
@@ -0,0 +1,19 @@
// FILE: test.kt
fun blockFun(blockArg: String.() -> Unit) =
"OK".blockArg()
fun box() {
blockFun ({
println(this)
})
}
// LOCAL VARIABLES
// test.kt:8 box:
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String
// test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String
// test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1
// test.kt:11 box:
@@ -81,11 +81,6 @@ public class AsmLikeInstructionListingTestGenerated extends AbstractAsmLikeInstr
runTest("compiler/testData/codegen/asmLike/receiverMangling/inlineReceivers.kt");
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/innerClass.kt");
}
@TestMetadata("localFunctions.kt")
public void testLocalFunctions() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/localFunctions.kt");
@@ -105,11 +100,6 @@ public class AsmLikeInstructionListingTestGenerated extends AbstractAsmLikeInstr
public void testNonInlineReceivers_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/nonInlineReceivers_before.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/simple.kt");
}
}
@TestMetadata("compiler/testData/codegen/asmLike/typeAnnotations")
@@ -67,24 +67,12 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest {
runTest("compiler/testData/debug/localVariables/jvmOverloads.kt");
}
@Test
@TestMetadata("lambdaWithExtensionReceiver.kt")
public void testLambdaWithExtensionReceiver() throws Exception {
runTest("compiler/testData/debug/localVariables/lambdaWithExtensionReceiver.kt");
}
@Test
@TestMetadata("localFun.kt")
public void testLocalFun() throws Exception {
runTest("compiler/testData/debug/localVariables/localFun.kt");
}
@Test
@TestMetadata("receiverParameter.kt")
public void testReceiverParameter() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverParameter.kt");
}
@Test
@TestMetadata("underscoreNames.kt")
public void testUnderscoreNames() throws Exception {
@@ -104,11 +92,53 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("capturedThisField.kt")
public void testCapturedThisField() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt");
}
@Test
@TestMetadata("labeledThisParameterLabel.kt")
public void testLabeledThisParameterLabel() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt");
}
@Test
@TestMetadata("lambdaWithExtensionReceiver.kt")
public void testLambdaWithExtensionReceiver() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt");
}
@Test
@TestMetadata("receiverParameter.kt")
public void testReceiverParameter() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simple.kt");
}
@Test
@TestMetadata("simpleCapturedReceiver.kt")
public void testSimpleCapturedReceiver() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt");
}
@Test
@TestMetadata("simpleCapturedReceiverWithLabel.kt")
public void testSimpleCapturedReceiverWithLabel() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt");
}
@Test
@TestMetadata("simpleCapturedReceiverWithParenthesis.kt")
public void testSimpleCapturedReceiverWithParenthesis() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt");
}
}
@TestMetadata("compiler/testData/debug/localVariables/suspend")
@@ -67,24 +67,12 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest {
runTest("compiler/testData/debug/localVariables/jvmOverloads.kt");
}
@Test
@TestMetadata("lambdaWithExtensionReceiver.kt")
public void testLambdaWithExtensionReceiver() throws Exception {
runTest("compiler/testData/debug/localVariables/lambdaWithExtensionReceiver.kt");
}
@Test
@TestMetadata("localFun.kt")
public void testLocalFun() throws Exception {
runTest("compiler/testData/debug/localVariables/localFun.kt");
}
@Test
@TestMetadata("receiverParameter.kt")
public void testReceiverParameter() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverParameter.kt");
}
@Test
@TestMetadata("underscoreNames.kt")
public void testUnderscoreNames() throws Exception {
@@ -104,11 +92,53 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("capturedThisField.kt")
public void testCapturedThisField() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt");
}
@Test
@TestMetadata("labeledThisParameterLabel.kt")
public void testLabeledThisParameterLabel() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt");
}
@Test
@TestMetadata("lambdaWithExtensionReceiver.kt")
public void testLambdaWithExtensionReceiver() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt");
}
@Test
@TestMetadata("receiverParameter.kt")
public void testReceiverParameter() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simple.kt");
}
@Test
@TestMetadata("simpleCapturedReceiver.kt")
public void testSimpleCapturedReceiver() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt");
}
@Test
@TestMetadata("simpleCapturedReceiverWithLabel.kt")
public void testSimpleCapturedReceiverWithLabel() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt");
}
@Test
@TestMetadata("simpleCapturedReceiverWithParenthesis.kt")
public void testSimpleCapturedReceiverWithParenthesis() throws Exception {
runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt");
}
}
@TestMetadata("compiler/testData/debug/localVariables/suspend")
@@ -81,11 +81,6 @@ public class IrAsmLikeInstructionListingTestGenerated extends AbstractIrAsmLikeI
runTest("compiler/testData/codegen/asmLike/receiverMangling/inlineReceivers.kt");
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/innerClass.kt");
}
@TestMetadata("localFunctions.kt")
public void testLocalFunctions() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/localFunctions.kt");
@@ -105,11 +100,6 @@ public class IrAsmLikeInstructionListingTestGenerated extends AbstractIrAsmLikeI
public void testNonInlineReceivers_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/nonInlineReceivers_before.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/simple.kt");
}
}
@TestMetadata("compiler/testData/codegen/asmLike/typeAnnotations")