From 371c4561a08b02097fa4ca475438ff4a95b935f3 Mon Sep 17 00:00:00 2001 From: Mark Punzalan Date: Tue, 12 May 2020 22:55:01 -0700 Subject: [PATCH] [IR/FIR] Use `isExpect` from IR element instead of descriptor in ExpectDeclarationRemover. --- .../jetbrains/kotlin/ir/util/ExpectDeclarationRemover.kt | 8 ++++++-- .../ir/serializationRegressions/dispatchReceiverValue.kt | 1 - .../defaultArguments/bothInExpectAndActual.kt | 1 - .../defaultArguments/bothInExpectAndActual2.kt | 1 - .../defaultArguments/dispatchReceiverValue.kt | 1 - .../defaultArguments/extensionReceiverValue.kt | 1 - .../defaultArguments/inheritedFromCommonClass.kt | 1 - .../box/multiplatform/expectClassInJvmMultifileFacade.kt | 1 - .../box/multiplatform/multiModule/expectActualLink.kt | 1 - .../multiplatform/multiModule/expectActualMemberLink.kt | 1 - .../multiModule/expectActualTypealiasLink.kt | 1 - 11 files changed, 6 insertions(+), 12 deletions(-) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExpectDeclarationRemover.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExpectDeclarationRemover.kt index 944e1c3299b..63c305480f4 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExpectDeclarationRemover.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ExpectDeclarationRemover.kt @@ -53,8 +53,12 @@ class ExpectDeclarationRemover(val symbolTable: ReferenceSymbolTable, private va } private fun shouldRemoveTopLevelDeclaration(declaration: IrDeclaration): Boolean { - val descriptor = declaration.descriptor - return doRemove && descriptor is MemberDescriptor && descriptor.isExpect + return doRemove && when (declaration) { + is IrClass -> declaration.isExpect + is IrProperty -> declaration.isExpect + is IrFunction -> declaration.isExpect + else -> false + } } private fun tryCopyDefaultArguments(declaration: IrValueParameter) { diff --git a/compiler/testData/codegen/box/ir/serializationRegressions/dispatchReceiverValue.kt b/compiler/testData/codegen/box/ir/serializationRegressions/dispatchReceiverValue.kt index 313f89bae58..6ffe4c088c4 100644 --- a/compiler/testData/codegen/box/ir/serializationRegressions/dispatchReceiverValue.kt +++ b/compiler/testData/codegen/box/ir/serializationRegressions/dispatchReceiverValue.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects // IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND_FIR: JVM_IR // MODULE: lib // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual.kt index 68eff881cea..6b56a9b4592 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: NATIVE // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt index 5193b71b868..3974053cdc8 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: NATIVE // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt index eb02f8b8479..b93a0c189ab 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_FIR: JVM_IR // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt index 7cd53cf85a6..9f8c33145b2 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_FIR: JVM_IR // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromCommonClass.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromCommonClass.kt index 329fce77e75..d1482e4be44 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromCommonClass.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromCommonClass.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/expectClassInJvmMultifileFacade.kt b/compiler/testData/codegen/box/multiplatform/expectClassInJvmMultifileFacade.kt index 70484feba3d..ac6c73b74f4 100644 --- a/compiler/testData/codegen/box/multiplatform/expectClassInJvmMultifileFacade.kt +++ b/compiler/testData/codegen/box/multiplatform/expectClassInJvmMultifileFacade.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects // TARGET_BACKEND: JVM -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt index 23c5a2e25fa..984c23fec55 100644 --- a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt +++ b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // EXPECT_ACTUAL_LINKER // IGNORE_BACKEND: JS -// IGNORE_BACKEND_FIR: JVM_IR // MODULE: A // FILE: a.kt diff --git a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt index 328dbc0cf70..ee5a708a6c5 100644 --- a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt +++ b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt @@ -2,7 +2,6 @@ // KJS_WITH_FULL_RUNTIME // EXPECT_ACTUAL_LINKER // IGNORE_BACKEND: JS -// IGNORE_BACKEND_FIR: JVM_IR // MODULE: A // FILE: a.kt diff --git a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt index a5bed37582b..0615ab2c07c 100644 --- a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt +++ b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt @@ -3,7 +3,6 @@ // EXPECT_ACTUAL_LINKER // IGNORE_BACKEND: JS // IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND_FIR: JVM_IR // MODULE: A // FILE: a.kt