From 7bfe2c0bbc5b3a5ad549811a93d88c3c1d780fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Sch=C3=A4fer?= Date: Tue, 17 Nov 2020 16:33:23 +0100 Subject: [PATCH] JVM IR: Update test expectation for testSamAdapterAndInlineOnce ...and remove redundant bytecode text tests. --- .../ir/FirBytecodeTextTestGenerated.java | 20 ------------- .../samAdapterAndInlinedOne.kt | 2 +- .../samAdapterAndInlinedOne.txt | 26 ++++++++--------- .../samAdapterAndInlinedOne_ir.txt | 28 +++++++++++++++++++ .../sam/samWrapperConstructorNonSynthetic.kt | 24 ---------------- .../samWrapperPrivateFinalSyntheticField.kt | 16 ----------- .../sam/samWrapperSyntheticFlags.kt | 23 --------------- ...samWrapperSyntheticImplementationMethod.kt | 21 -------------- .../codegen/BytecodeTextTestGenerated.java | 20 ------------- .../ir/IrBytecodeTextTestGenerated.java | 20 ------------- 10 files changed, 42 insertions(+), 158 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne_ir.txt delete mode 100644 compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt delete mode 100644 compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt delete mode 100644 compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt delete mode 100644 compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java index 5bd3fe59e86..319b6bd6eed 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBytecodeTextTestGenerated.java @@ -4314,11 +4314,6 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } - @TestMetadata("samWrapperConstructorNonSynthetic.kt") - public void testSamWrapperConstructorNonSynthetic() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt"); - } - @TestMetadata("samWrapperForNullInitialization.kt") public void testSamWrapperForNullInitialization() throws Exception { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperForNullInitialization.kt"); @@ -4344,25 +4339,10 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt"); } - @TestMetadata("samWrapperPrivateFinalSyntheticField.kt") - public void testSamWrapperPrivateFinalSyntheticField() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt"); - } - @TestMetadata("samWrapperRawTypes.kt") public void testSamWrapperRawTypes() throws Exception { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt"); } - - @TestMetadata("samWrapperSyntheticFlags.kt") - public void testSamWrapperSyntheticFlags() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt"); - } - - @TestMetadata("samWrapperSyntheticImplementationMethod.kt") - public void testSamWrapperSyntheticImplementationMethod() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt"); - } } @TestMetadata("compiler/testData/codegen/bytecodeText/statements") diff --git a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt b/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt index 41842c7243a..5fb0edbf713 100644 --- a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt +++ b/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JVM_IR +// WITH_SIGNATURES package test inline fun makeRunnable(noinline lambda: ()->Unit) : Runnable { diff --git a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.txt b/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.txt index c5fa758a56b..81039b208ed 100644 --- a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.txt +++ b/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne.txt @@ -1,24 +1,24 @@ @kotlin.Metadata -public final class test/SamAdapterAndInlinedOneKt$sam$i$java_lang_Runnable$0 { +public final class test/SamAdapterAndInlinedOneKt$sam$i$java_lang_Runnable$0 { // source: 'samAdapterAndInlinedOne.kt' - private synthetic final field function: kotlin.jvm.functions.Function0 - public method (p0: kotlin.jvm.functions.Function0): void - public synthetic final method run(): void + public method (p0: kotlin.jvm.functions.Function0): void + public synthetic final method run(): void + private synthetic final field function: kotlin.jvm.functions.Function0 } @kotlin.Metadata -final class test/SamAdapterAndInlinedOneKt$sam$java_lang_Runnable$0 { +final class test/SamAdapterAndInlinedOneKt$sam$java_lang_Runnable$0 { // source: 'samAdapterAndInlinedOne.kt' - private synthetic final field function: kotlin.jvm.functions.Function0 - method (p0: kotlin.jvm.functions.Function0): void - public synthetic final method run(): void + method (p0: kotlin.jvm.functions.Function0): void + public synthetic final method run(): void + private synthetic final field function: kotlin.jvm.functions.Function0 } @kotlin.Metadata -public final class test/SamAdapterAndInlinedOneKt { +public final class test/SamAdapterAndInlinedOneKt { // source: 'samAdapterAndInlinedOne.kt' - public synthetic final static method makeRunnable(p0: kotlin.jvm.functions.Function0): java.lang.Runnable - public final static @org.jetbrains.annotations.NotNull method makeRunnable2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable - public final static @org.jetbrains.annotations.NotNull method noInline(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable - public final static @org.jetbrains.annotations.NotNull method noInline2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method makeRunnable2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method noInline(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method noInline2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public synthetic final static <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method makeRunnable(p0: kotlin.jvm.functions.Function0): java.lang.Runnable } diff --git a/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne_ir.txt b/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne_ir.txt new file mode 100644 index 00000000000..21760d85a83 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/samAdapterAndInlinedOne_ir.txt @@ -0,0 +1,28 @@ +@kotlin.Metadata +public final class test/SamAdapterAndInlinedOneKt$sam$i$java_lang_Runnable$0 { + // source: 'samAdapterAndInlinedOne.kt' + public method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void + public synthetic final method run(): void + private synthetic final field function: kotlin.jvm.functions.Function0 + public final inner class test/SamAdapterAndInlinedOneKt$sam$i$java_lang_Runnable$0 +} + +@kotlin.Metadata +final class test/SamAdapterAndInlinedOneKt$sam$java_lang_Runnable$0 { + // source: 'samAdapterAndInlinedOne.kt' + method (@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void + public synthetic final method run(): void + private synthetic final field function: kotlin.jvm.functions.Function0 + final inner class test/SamAdapterAndInlinedOneKt$sam$java_lang_Runnable$0 +} + +@kotlin.Metadata +public final class test/SamAdapterAndInlinedOneKt { + // source: 'samAdapterAndInlinedOne.kt' + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method makeRunnable2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method noInline(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public final static @org.jetbrains.annotations.NotNull <(Lkotlin/jvm/functions/Function0;)Ljava/lang/Runnable;> method noInline2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Runnable + public synthetic final static method makeRunnable(p0: kotlin.jvm.functions.Function0): java.lang.Runnable + final inner class test/SamAdapterAndInlinedOneKt$sam$java_lang_Runnable$0 + public final inner class test/SamAdapterAndInlinedOneKt$sam$i$java_lang_Runnable$0 +} diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt deleted file mode 100644 index 3c52a199bb4..00000000000 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt +++ /dev/null @@ -1,24 +0,0 @@ -// FILE: J.java - -public class J { - public static void g(Runnable r) { - r.run(); - } -} - -// FILE: test.kt - -fun nonInlineFun() { - val f = {} - J.g(f) -} - -inline fun inlineFun() { - val f = {} - J.g(f) -} - -// The SAM wrapper constructor is public inside of inline functions. -// It has no other flags. In particular, it is not synthetic. -// 1 access flags 0x0\n\s*\(Lkotlin/jvm/functions/Function0;\)V -// 1 access flags 0x1\n\s*public \(Lkotlin/jvm/functions/Function0;\)V diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt deleted file mode 100644 index 30d4f2130c7..00000000000 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt +++ /dev/null @@ -1,16 +0,0 @@ -// FILE: J.java - -public class J { - public static void g(Runnable r) { - r.run(); - } -} - -// FILE: test.kt - -fun f() { - val r: () -> Unit = {} - J.g(r) -} - -// 1 private final synthetic Lkotlin/jvm/functions/Function0; function \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt deleted file mode 100644 index 0e511aa2cea..00000000000 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: J.java - -public class J { - public static void g(Runnable r) { - r.run(); - } -} - -// FILE: test.kt - -fun nonInlineFun() { - val f = {} - J.g(f) -} - -inline fun inlineFun() { - val f = {} - J.g(f) -} - -// 1 final class TestKt\$sam\$java_lang_Runnable\$0 implements java/lang/Runnable -// 0 public final class TestKt\$sam\$java_lang_Runnable\$0 implements java/lang/Runnable -// 1 public final class TestKt\$sam\$i\$java_lang_Runnable\$0 implements java/lang/Runnable \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt deleted file mode 100644 index a92f33d0ce5..00000000000 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FILE: J.java - -public class J { - public static void g(Runnable r) { - r.run(); - } -} - -// FILE: test.kt - -fun nonInlineFun() { - val f = {} - J.g(f) -} - -inline fun inlineFun() { - val f = {} - J.g(f) -} - -// 2 public final synthetic run\(\)V \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index a1c09a4937e..93a10805ec3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -4386,11 +4386,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("samWrapperConstructorNonSynthetic.kt") - public void testSamWrapperConstructorNonSynthetic() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt"); - } - @TestMetadata("samWrapperForNullInitialization.kt") public void testSamWrapperForNullInitialization() throws Exception { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperForNullInitialization.kt"); @@ -4416,25 +4411,10 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt"); } - @TestMetadata("samWrapperPrivateFinalSyntheticField.kt") - public void testSamWrapperPrivateFinalSyntheticField() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt"); - } - @TestMetadata("samWrapperRawTypes.kt") public void testSamWrapperRawTypes() throws Exception { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt"); } - - @TestMetadata("samWrapperSyntheticFlags.kt") - public void testSamWrapperSyntheticFlags() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt"); - } - - @TestMetadata("samWrapperSyntheticImplementationMethod.kt") - public void testSamWrapperSyntheticImplementationMethod() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt"); - } } @TestMetadata("compiler/testData/codegen/bytecodeText/statements") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index 6fa273af54a..5c6213c0ca3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -4314,11 +4314,6 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } - @TestMetadata("samWrapperConstructorNonSynthetic.kt") - public void testSamWrapperConstructorNonSynthetic() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperConstructorNonSynthetic.kt"); - } - @TestMetadata("samWrapperForNullInitialization.kt") public void testSamWrapperForNullInitialization() throws Exception { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperForNullInitialization.kt"); @@ -4344,25 +4339,10 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt"); } - @TestMetadata("samWrapperPrivateFinalSyntheticField.kt") - public void testSamWrapperPrivateFinalSyntheticField() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperPrivateFinalSyntheticField.kt"); - } - @TestMetadata("samWrapperRawTypes.kt") public void testSamWrapperRawTypes() throws Exception { runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt"); } - - @TestMetadata("samWrapperSyntheticFlags.kt") - public void testSamWrapperSyntheticFlags() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt"); - } - - @TestMetadata("samWrapperSyntheticImplementationMethod.kt") - public void testSamWrapperSyntheticImplementationMethod() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt"); - } } @TestMetadata("compiler/testData/codegen/bytecodeText/statements")