From 75d3ae44669c705b7560624cc61d4b29edafa24f Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Wed, 11 Jan 2023 15:37:39 +0100 Subject: [PATCH] [Wasm] Don't try to lazy-initialize properties with 'definedExternally' NFC for K/JS since externals live in a separate place --- .../kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt | 2 +- js/js.translator/testData/box/native/kt2209.kt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index f7630c08b0b..b54cf578c17 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -284,7 +284,7 @@ private fun IrDeclaration.withPersistentSafe(transform: IrDeclaration.() -> private fun IrDeclaration.isCompatibleDeclaration(context: JsCommonBackendContext) = correspondingProperty?.let { - it.isForLazyInit() && !it.hasAnnotation(context.propertyLazyInitialization.eagerInitialization) + !it.isExternal && it.isForLazyInit() && !it.hasAnnotation(context.propertyLazyInitialization.eagerInitialization) } ?: true && withPersistentSafe { origin in compatibleOrigins } == true private val compatibleOrigins = listOf( diff --git a/js/js.translator/testData/box/native/kt2209.kt b/js/js.translator/testData/box/native/kt2209.kt index 0e9460c1929..39759e7c5a9 100644 --- a/js/js.translator/testData/box/native/kt2209.kt +++ b/js/js.translator/testData/box/native/kt2209.kt @@ -1,6 +1,4 @@ // EXPECTED_REACHABLE_NODES: 1281 -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: LAZY_INIT_PROPERTIES package foo external interface Chrome {