diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java index 84630348abd..78cb73d344c 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/codegen/FirCompileKotlinAgainstKotlinTestGenerated.java @@ -245,6 +245,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithDefaultArgs.kt"); } + @TestMetadata("internalWithInlineClass.kt") + public void testInternalWithInlineClass() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt"); + } + @TestMetadata("internalWithOtherModuleName.kt") public void testInternalWithOtherModuleName() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithOtherModuleName.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt index 30b0ad3cb90..ab1e9090d9a 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/MethodSignatureMapper.kt @@ -134,7 +134,10 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { origin != JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_OR_TYPEALIAS_ANNOTATIONS && !isPublishedApi() ) { - return this + return originalFunction.takeIf { it != this } + ?.safeAs() + ?.getInternalFunctionForManglingIfNeeded() + ?: this } originalForDefaultAdapter?.getInternalFunctionForManglingIfNeeded()?.let { return it } return null diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt index 1dcae594b3d..a9d18685a60 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/irCodegenUtils.kt @@ -383,12 +383,13 @@ fun IrSimpleType.isRawType(): Boolean = hasAnnotation(JvmGeneratorExtensions.RAW_TYPE_ANNOTATION_FQ_NAME) internal fun classFileContainsMethod(classId: ClassId, function: IrFunction, context: JvmBackendContext): Boolean? { - val originalDescriptor = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod.descriptor + val originalSignature = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod + val originalDescriptor = originalSignature.descriptor val descriptor = if (function.isSuspend) listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation")) .joinToString(prefix = "(", postfix = ")", separator = "") + AsmTypes.OBJECT_TYPE else originalDescriptor - return classFileContainsMethod(classId, context.state, Method(function.name.asString(), descriptor)) + return classFileContainsMethod(classId, context.state, Method(originalSignature.name, descriptor)) } val IrMemberWithContainerSource.parentClassId: ClassId? diff --git a/compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt b/compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt new file mode 100644 index 00000000000..939d2ee11fe --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt @@ -0,0 +1,16 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// FILE: A.kt + +package a + +inline class Message(val value: String) + +class Box { + internal fun result(msg: Message): String = msg.value +} + +// FILE: B.kt + +fun box(): String { + return a.Box().result(a.Message("OK")) +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index fcc51dc8196..db674468db1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -244,6 +244,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithDefaultArgs.kt"); } + @TestMetadata("internalWithInlineClass.kt") + public void testInternalWithInlineClass() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt"); + } + @TestMetadata("internalWithOtherModuleName.kt") public void testInternalWithOtherModuleName() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithOtherModuleName.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index 0cb25e9e39d..5d113d872e1 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -245,6 +245,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithDefaultArgs.kt"); } + @TestMetadata("internalWithInlineClass.kt") + public void testInternalWithInlineClass() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt"); + } + @TestMetadata("internalWithOtherModuleName.kt") public void testInternalWithOtherModuleName() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithOtherModuleName.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java index 8e232cfc58f..7a938973a5b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmIrAgainstOldBoxTestGenerated.java @@ -245,6 +245,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithDefaultArgs.kt"); } + @TestMetadata("internalWithInlineClass.kt") + public void testInternalWithInlineClass() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt"); + } + @TestMetadata("internalWithOtherModuleName.kt") public void testInternalWithOtherModuleName() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithOtherModuleName.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java index 842f7dc7c68..05848569b43 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/JvmOldAgainstIrBoxTestGenerated.java @@ -245,6 +245,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithDefaultArgs.kt"); } + @TestMetadata("internalWithInlineClass.kt") + public void testInternalWithInlineClass() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithInlineClass.kt"); + } + @TestMetadata("internalWithOtherModuleName.kt") public void testInternalWithOtherModuleName() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/internalWithOtherModuleName.kt");