diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DeepCopyIrTreeWithDescriptors.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DeepCopyIrTreeWithDescriptors.kt index cc6d5cf522f..624fb13e8a2 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DeepCopyIrTreeWithDescriptors.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DeepCopyIrTreeWithDescriptors.kt @@ -356,7 +356,10 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor, oldDescriptor.name // We need to preserve it for LocalDeclarationsLowering. else generateCopyName(oldDescriptor.name) - return ClassDescriptorImpl( + + val visibility = oldDescriptor.visibility + + return object : ClassDescriptorImpl( /* containingDeclaration = */ newContainingDeclaration, /* name = */ newName, /* modality = */ oldDescriptor.modality, @@ -364,7 +367,9 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor, /* supertypes = */ listOf(newSuperClass.defaultType) + newInterfaces.map { it.defaultType }, /* source = */ oldDescriptor.source, /* isExternal = */ oldDescriptor.isExternal - ) + ) { + override fun getVisibility() = visibility + } } }