diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/PropertiesLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/PropertiesLowering.kt index e9828181019..c2972eaaa8a 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/PropertiesLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/PropertiesLowering.kt @@ -28,6 +28,7 @@ import java.util.* class PropertiesLowering( private val context: BackendContext, private val originOfSyntheticMethodForAnnotations: IrDeclarationOrigin? = null, + private val skipExternalProperties: Boolean = false, private val computeSyntheticMethodName: ((Name) -> String)? = null ) : IrElementTransformerVoid(), FileLoweringPass { override fun lower(irFile: IrFile) { @@ -48,7 +49,7 @@ class PropertiesLowering( private fun lowerProperty(declaration: IrDeclaration, kind: ClassKind): List? = if (declaration is IrProperty) - if (declaration.isEffectivelyExternal()) listOf(declaration) else { + if (skipExternalProperties && declaration.isEffectivelyExternal()) listOf(declaration) else { ArrayList(4).apply { // JvmFields in a companion object refer to companion's owners and should not be generated within companion. if (kind != ClassKind.ANNOTATION_CLASS && declaration.backingField?.parent == declaration.parent) { diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index ba01386a685..83f6cd278f1 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -240,7 +240,7 @@ private val varargLoweringPhase = makeJsModulePhase( ) private val propertiesLoweringPhase = makeJsModulePhase( - { context -> PropertiesLowering(context) }, + { context -> PropertiesLowering(context, skipExternalProperties = true) }, name = "PropertiesLowering", description = "Move fields and accessors out from its property" )