diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt index a70771eee1b..b0bc0bbbf4b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt @@ -366,7 +366,7 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) private fun createInvokeMethod(receiverVar: IrValueDeclaration?): IrSimpleFunction = functionReferenceClass.addFunction { setSourceRange(if (isLambda) callee else irFunctionReference) - name = if (callee.returnType.erasedUpperBound.isInline && context.state.functionsWithInlineClassReturnTypesMangled) { + name = if (samSuperType == null && callee.returnType.erasedUpperBound.isInline && context.state.functionsWithInlineClassReturnTypesMangled) { // For functions with inline class return type we need to mangle the invoke method. // Otherwise, bridge lowering may fail to generate bridges for inline class types erasing to Any. val suffix = InlineClassAbi.returnHashSuffix(callee) diff --git a/compiler/testData/codegen/bytecodeListing/kt42879.kt b/compiler/testData/codegen/bytecodeListing/kt42879.kt new file mode 100644 index 00000000000..3333abea0f8 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt42879.kt @@ -0,0 +1,12 @@ +// IGNORE_BACKEND: JVM +inline class A(val value: Int) + +fun interface I { + fun compute(value: Int): A +} + +fun f(i: I) {} + +fun g() { + f { it -> A(it) } +} diff --git a/compiler/testData/codegen/bytecodeListing/kt42879.txt b/compiler/testData/codegen/bytecodeListing/kt42879.txt new file mode 100644 index 00000000000..08e63465dff --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/kt42879.txt @@ -0,0 +1,42 @@ +@kotlin.Metadata +public final class A { + // source: 'kt42879.kt' + private final field value: int + private synthetic method (p0: int): void + public synthetic final static method box-impl(p0: int): A + public static method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getValue(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} + +@kotlin.Metadata +public interface I { + // source: 'kt42879.kt' + public abstract method compute-GKOAj6k(p0: int): int +} + +@kotlin.Metadata +final class Kt42879Kt$g$1 { + // source: 'kt42879.kt' + enclosing method Kt42879Kt.g()V + public final static field INSTANCE: Kt42879Kt$g$1 + inner (anonymous) class Kt42879Kt$g$1 + static method (): void + method (): void + public final method compute-GKOAj6k(p0: int): int +} + +@kotlin.Metadata +public final class Kt42879Kt { + // source: 'kt42879.kt' + inner (anonymous) class Kt42879Kt$g$1 + public final static method f(@org.jetbrains.annotations.NotNull p0: I): void + public final static method g(): void +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 89076168231..9853ee6037d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -22,7 +22,7 @@ import java.util.regex.Pattern; @RunWith(JUnit3RunnerWithInners.class) public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @TestMetadata("accessorForProtectedPropertyWithPrivateSetter.kt") @@ -36,7 +36,7 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { } public void testAllFilesPresentInBytecodeListing() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("callableNameIntrinsic.kt") @@ -104,6 +104,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt"); } + @TestMetadata("kt42879.kt") + public void testKt42879() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt42879.kt"); + } + @TestMetadata("localFunctionInInitBlock.kt") public void testLocalFunctionInInitBlock() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt"); @@ -179,11 +184,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Annotations extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInAnnotations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/annotations"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("annotationsOnDelegatedMembers.kt") @@ -262,11 +267,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class CollectionStubs extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInCollectionStubs() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("collectionByDelegation.kt") @@ -404,11 +409,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class AbstractStubSignatures extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInAbstractStubSignatures() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs/abstractStubSignatures"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs/abstractStubSignatures"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("byteShortMap.kt") @@ -553,15 +558,15 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Coroutines extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception { - KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.ANY, testDataFilePath); + KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInCoroutines() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("coroutineContextIntrinsic.kt") @@ -634,11 +639,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Spilling extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInSpilling() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines/spilling"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines/spilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("booleanParameter.kt") @@ -683,11 +688,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class DefaultArguments extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInDefaultArguments() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("internalNameMangling.kt") @@ -706,11 +711,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Deprecated extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInDeprecated() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("deprecatedClass.kt") @@ -739,11 +744,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Inline extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInInline() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inline"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inline"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("inlineOnly.kt") @@ -796,11 +801,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class EnclosingInfo extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInEnclosingInfo() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inline/enclosingInfo"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inline/enclosingInfo"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("crossinlineLambdaChain.kt") @@ -840,11 +845,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class InlineClasses extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInInlineClasses() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("annotatedPropertyWithInlineClassTypeInSignature.kt") @@ -942,11 +947,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class InlineCollection extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInInlineCollection() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollection"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("collection.kt") @@ -1025,11 +1030,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class InlineCollectionOfInlineClass extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInInlineCollectionOfInlineClass() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollectionOfInlineClass"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCollectionOfInlineClass"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("collection.kt") @@ -1114,11 +1119,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Jvm8 extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInJvm8() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("compiler/testData/codegen/bytecodeListing/jvm8/defaults") @@ -1126,11 +1131,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Defaults extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInDefaults() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility") @@ -1138,11 +1143,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class AllCompatibility extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInAllCompatibility() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("deprecation.kt") @@ -1170,11 +1175,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Specialization extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInSpecialization() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/specialization"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/jvm8/defaults/allCompatibility/specialization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("primitiveAndAny.kt") @@ -1196,11 +1201,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Main extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInMain() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/main"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/main"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("multifileSuspend.kt") @@ -1234,11 +1239,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Multiplatform extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInMultiplatform() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("optionalExpectation.kt") @@ -1252,11 +1257,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class NullabilityAnnotations extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInNullabilityAnnotations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/nullabilityAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/nullabilityAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("lateInitNotNull.kt") @@ -1290,7 +1295,7 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class SpecialBridges extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @TestMetadata("abstractCollections.kt") @@ -1334,7 +1339,7 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { } public void testAllFilesPresentInSpecialBridges() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("charSequence.kt") @@ -1392,11 +1397,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { @RunWith(JUnit3RunnerWithInners.class) public static class Signatures extends AbstractBytecodeListingTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } public void testAllFilesPresentInSignatures() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges/signatures"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges/signatures"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } @TestMetadata("genericClass.kt") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 4c8c9ba2923..aafa9cca057 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -104,6 +104,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt"); } + @TestMetadata("kt42879.kt") + public void testKt42879() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/kt42879.kt"); + } + @TestMetadata("localFunctionInInitBlock.kt") public void testLocalFunctionInInitBlock() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 601cc90f0f8..cbd6649fdc8 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -242,7 +242,7 @@ fun main(args: Array) { testClass { - model("codegen/bytecodeListing") + model("codegen/bytecodeListing", targetBackend = TargetBackend.JVM) } testClass {