From b42adcd73d90d17e9855e35f3eb6922a3a574496 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 11 Apr 2019 17:08:43 +0300 Subject: [PATCH] Restructure bytecode listing tests on InlineOnly/inline+reified --- .../{ => inline}/InlineOnlyMultifile.kt | 7 +-- .../{ => inline}/InlineOnlyMultifile.txt | 3 +- .../InlineOnlyPropertyMultifile.kt | 4 -- .../InlineOnlyPropertyMultifile.txt | 1 - .../inline/InlineReifiedMultifile.kt | 10 ++++ .../inline/InlineReifiedMultifile.txt | 10 ++++ .../inline/InlineReifiedPropertyMultifile.kt | 11 ++++ .../inline/InlineReifiedPropertyMultifile.txt | 10 ++++ .../{ => inline}/inlineOnly.kt | 8 --- .../{ => inline}/inlineOnly.txt | 4 -- .../{ => inline}/inlineOnlyProperty.kt | 10 ---- .../{ => inline}/inlineOnlyProperty.txt | 2 - .../bytecodeListing/inline/inlineReified.kt | 9 +++ .../bytecodeListing/inline/inlineReified.txt | 12 ++++ .../inline/inlineReifiedProperty.kt | 7 +++ .../inline/inlineReifiedProperty.txt | 10 ++++ .../codegen/BytecodeListingTestGenerated.java | 60 ++++++++++++------- 17 files changed, 122 insertions(+), 56 deletions(-) rename compiler/testData/codegen/bytecodeListing/{ => inline}/InlineOnlyMultifile.kt (72%) rename compiler/testData/codegen/bytecodeListing/{ => inline}/InlineOnlyMultifile.txt (78%) rename compiler/testData/codegen/bytecodeListing/{ => inline}/InlineOnlyPropertyMultifile.kt (84%) rename compiler/testData/codegen/bytecodeListing/{ => inline}/InlineOnlyPropertyMultifile.txt (84%) create mode 100644 compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.txt rename compiler/testData/codegen/bytecodeListing/{ => inline}/inlineOnly.kt (65%) rename compiler/testData/codegen/bytecodeListing/{ => inline}/inlineOnly.txt (62%) rename compiler/testData/codegen/bytecodeListing/{ => inline}/inlineOnlyProperty.kt (83%) rename compiler/testData/codegen/bytecodeListing/{ => inline}/inlineOnlyProperty.txt (85%) create mode 100644 compiler/testData/codegen/bytecodeListing/inline/inlineReified.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inline/inlineReified.txt create mode 100644 compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.kt create mode 100644 compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.txt diff --git a/compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.kt b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.kt similarity index 72% rename from compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.kt rename to compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.kt index 9883620176b..9ca588a09ef 100644 --- a/compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.kt +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.kt @@ -4,14 +4,11 @@ package test fun foo() { - inlineOnly() - inlineOnlyAnnotated() + inlineOnly() } // No method should be generated in multifile facade for 'inlineOnly' // Because 'inlineOnly' is private in file part (because it's inline-only) and can't be delegated from facade -public inline fun inlineOnly() {} - @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @kotlin.internal.InlineOnly -inline fun inlineOnlyAnnotated() { } +inline fun inlineOnly() { } diff --git a/compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.txt b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.txt similarity index 78% rename from compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.txt rename to compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.txt index 17646e6f65f..c521fefdce0 100644 --- a/compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.txt +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.txt @@ -6,6 +6,5 @@ public final class test/Foo { @kotlin.Metadata synthetic final class test/Foo__InlineOnlyMultifileKt { public final static method foo(): void - private final static method inlineOnly(): void - private final static @kotlin.internal.InlineOnly method inlineOnlyAnnotated(): void + private final static @kotlin.internal.InlineOnly method inlineOnly(): void } diff --git a/compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.kt b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.kt similarity index 84% rename from compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.kt rename to compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.kt index 6a6d2566328..eea86a13e37 100644 --- a/compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.kt +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.kt @@ -5,7 +5,6 @@ package test fun foo() { prop - "".extProp } // No method should be generated in multifile facade for 'inlineOnly' @@ -15,6 +14,3 @@ fun foo() { inline var prop: String get() = "12" set(value) {} - -inline val Z.extProp: String - get() = "123" diff --git a/compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.txt b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.txt similarity index 84% rename from compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.txt rename to compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.txt index 5df386f0305..c0f11548e7c 100644 --- a/compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.txt +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.txt @@ -6,7 +6,6 @@ public final class test/Foo { @kotlin.Metadata synthetic final class test/Foo__InlineOnlyPropertyMultifileKt { public final static method foo(): void - private final static method getExtProp(p0: java.lang.Object): java.lang.String private final static method getProp(): java.lang.String public synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void private final static method setProp(p0: java.lang.String): void diff --git a/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.kt b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.kt new file mode 100644 index 00000000000..a73ab89072c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +@file:[JvmName("Foo") JvmMultifileClass] +package test + +fun foo() { + inlineReified() +} + +public inline fun inlineReified() {} diff --git a/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.txt b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.txt new file mode 100644 index 00000000000..f8fd810a97d --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.txt @@ -0,0 +1,10 @@ +@kotlin.Metadata +public final class test/Foo { + public final static method foo(): void +} + +@kotlin.Metadata +synthetic final class test/Foo__InlineReifiedMultifileKt { + public final static method foo(): void + private final static method inlineReified(): void +} diff --git a/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.kt b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.kt new file mode 100644 index 00000000000..15ae30ba78c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME + +@file:[JvmName("Foo") JvmMultifileClass] +package test + +fun foo() { + "".extProp +} + +inline val Z.extProp: String + get() = "123" diff --git a/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.txt b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.txt new file mode 100644 index 00000000000..13a193d578f --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.txt @@ -0,0 +1,10 @@ +@kotlin.Metadata +public final class test/Foo { + public final static method foo(): void +} + +@kotlin.Metadata +synthetic final class test/Foo__InlineReifiedPropertyMultifileKt { + public final static method foo(): void + private final static method getExtProp(p0: java.lang.Object): java.lang.String +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineOnly.kt b/compiler/testData/codegen/bytecodeListing/inline/inlineOnly.kt similarity index 65% rename from compiler/testData/codegen/bytecodeListing/inlineOnly.kt rename to compiler/testData/codegen/bytecodeListing/inline/inlineOnly.kt index df8de84ead5..19accf6201c 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineOnly.kt +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineOnly.kt @@ -4,16 +4,8 @@ @kotlin.internal.InlineOnly inline fun foo() { } -inline fun bar() { } - -inline fun baz() {} - class Foo { @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @kotlin.internal.InlineOnly inline fun foo() { } - - inline fun bar() { } - - inline fun baz() {} } diff --git a/compiler/testData/codegen/bytecodeListing/inlineOnly.txt b/compiler/testData/codegen/bytecodeListing/inline/inlineOnly.txt similarity index 62% rename from compiler/testData/codegen/bytecodeListing/inlineOnly.txt rename to compiler/testData/codegen/bytecodeListing/inline/inlineOnly.txt index 0864d92b1f4..be21cc3202d 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineOnly.txt +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineOnly.txt @@ -1,14 +1,10 @@ @kotlin.Metadata public final class Foo { public method (): void - public final method bar(): void - private final method baz(): void private final @kotlin.internal.InlineOnly method foo(): void } @kotlin.Metadata public final class InlineOnlyKt { - public final static method bar(): void - private final static method baz(): void private final static @kotlin.internal.InlineOnly method foo(): void } diff --git a/compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.kt b/compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.kt similarity index 83% rename from compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.kt rename to compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.kt index 77a5c5e0d29..84be35ba95e 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.kt +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.kt @@ -1,4 +1,3 @@ - // WITH_RUNTIME @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @@ -14,11 +13,7 @@ inline var prop2: String set(value) {} -inline val Z.extProp: String - get() = "123" - class Foo { - @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @kotlin.internal.InlineOnly inline var prop: String @@ -30,9 +25,4 @@ class Foo { @kotlin.internal.InlineOnly get() = "12" set(value) {} - - - inline val Z.extProp: String - get() = "123" - } diff --git a/compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.txt b/compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.txt similarity index 85% rename from compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.txt rename to compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.txt index ef353da9bca..75bbe2f45ad 100644 --- a/compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.txt +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.txt @@ -1,7 +1,6 @@ @kotlin.Metadata public final class Foo { public method (): void - private final method getExtProp(p0: java.lang.Object): java.lang.String private final method getProp(): java.lang.String private final @kotlin.internal.InlineOnly method getProp2(): java.lang.String public synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void @@ -11,7 +10,6 @@ public final class Foo { @kotlin.Metadata public final class InlineOnlyPropertyKt { - private final static method getExtProp(p0: java.lang.Object): java.lang.String private final static method getProp(): java.lang.String private final static @kotlin.internal.InlineOnly method getProp2(): java.lang.String public synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void diff --git a/compiler/testData/codegen/bytecodeListing/inline/inlineReified.kt b/compiler/testData/codegen/bytecodeListing/inline/inlineReified.kt new file mode 100644 index 00000000000..68dc34d48ab --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineReified.kt @@ -0,0 +1,9 @@ +inline fun bar() { } + +inline fun baz() {} + +class Foo { + inline fun bar() { } + + inline fun baz() {} +} diff --git a/compiler/testData/codegen/bytecodeListing/inline/inlineReified.txt b/compiler/testData/codegen/bytecodeListing/inline/inlineReified.txt new file mode 100644 index 00000000000..5785773aaa3 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineReified.txt @@ -0,0 +1,12 @@ +@kotlin.Metadata +public final class Foo { + public method (): void + public final method bar(): void + private final method baz(): void +} + +@kotlin.Metadata +public final class InlineReifiedKt { + public final static method bar(): void + private final static method baz(): void +} diff --git a/compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.kt b/compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.kt new file mode 100644 index 00000000000..f24ca57dc30 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.kt @@ -0,0 +1,7 @@ +inline val Z.extProp: String + get() = "123" + +class Foo { + inline val Z.extProp: String + get() = "456" +} diff --git a/compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.txt b/compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.txt new file mode 100644 index 00000000000..106c7fb78ce --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.txt @@ -0,0 +1,10 @@ +@kotlin.Metadata +public final class Foo { + public method (): void + private final method getExtProp(p0: java.lang.Object): java.lang.String +} + +@kotlin.Metadata +public final class InlineReifiedPropertyKt { + private final static method getExtProp(p0: java.lang.Object): java.lang.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index db23e46a0b9..584945ea869 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -88,26 +88,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/immutableCollection.kt"); } - @TestMetadata("inlineOnly.kt") - public void testInlineOnly() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/inlineOnly.kt"); - } - - @TestMetadata("InlineOnlyMultifile.kt") - public void testInlineOnlyMultifile() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/InlineOnlyMultifile.kt"); - } - - @TestMetadata("inlineOnlyProperty.kt") - public void testInlineOnlyProperty() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/inlineOnlyProperty.kt"); - } - - @TestMetadata("InlineOnlyPropertyMultifile.kt") - public void testInlineOnlyPropertyMultifile() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/InlineOnlyPropertyMultifile.kt"); - } - @TestMetadata("jvmOverloadsAndParametersAnnotations.kt") public void testJvmOverloadsAndParametersAnnotations() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsAndParametersAnnotations.kt"); @@ -291,6 +271,46 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inline"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("inlineOnly.kt") + public void testInlineOnly() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/inlineOnly.kt"); + } + + @TestMetadata("InlineOnlyMultifile.kt") + public void testInlineOnlyMultifile() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/InlineOnlyMultifile.kt"); + } + + @TestMetadata("inlineOnlyProperty.kt") + public void testInlineOnlyProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/inlineOnlyProperty.kt"); + } + + @TestMetadata("InlineOnlyPropertyMultifile.kt") + public void testInlineOnlyPropertyMultifile() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/InlineOnlyPropertyMultifile.kt"); + } + + @TestMetadata("inlineReified.kt") + public void testInlineReified() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/inlineReified.kt"); + } + + @TestMetadata("InlineReifiedMultifile.kt") + public void testInlineReifiedMultifile() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/InlineReifiedMultifile.kt"); + } + + @TestMetadata("inlineReifiedProperty.kt") + public void testInlineReifiedProperty() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/inlineReifiedProperty.kt"); + } + + @TestMetadata("InlineReifiedPropertyMultifile.kt") + public void testInlineReifiedPropertyMultifile() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inline/InlineReifiedPropertyMultifile.kt"); + } + @TestMetadata("simpleNamed.kt") public void testSimpleNamed() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inline/simpleNamed.kt");