From dc4b9d3887bd0e232aa8a96a534efcdcefea2f6f Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 2 Jul 2020 12:57:18 +0300 Subject: [PATCH] JVM_IR: Don't mangle internal constructor-impl for inline classes --- .../backend/jvm/codegen/MethodSignatureMapper.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 c8380e3c6f2..c677df424f9 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 @@ -111,11 +111,18 @@ class MethodSignatureMapper(private val context: JvmBackendContext) { return newName } - return if (function !is IrConstructor && function.visibility == Visibilities.INTERNAL && !function.isPublishedApi()) { + return if (function.shouldMangleAsInternal()) KotlinTypeMapper.InternalNameMapper.mangleInternalName(newName, getModuleName(function)) - } else newName + else + newName } + private fun IrFunction.shouldMangleAsInternal() = + this !is IrConstructor && + origin != JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_CONSTRUCTOR && + visibility == Visibilities.INTERNAL && + !isPublishedApi() + private fun getModuleName(function: IrFunction): String = (if (function is IrLazyFunctionBase) getJvmModuleNameForDeserialized(function)