From e7bf4da79611829acd30c46765fa875410723ed1 Mon Sep 17 00:00:00 2001 From: Marco Pennekamp Date: Fri, 20 Jan 2023 14:08:21 +0100 Subject: [PATCH] [JVM IR] KTIJ-24335 Require stubbing for built-in symbol deduplication - Built-in symbol deduplication has only been tested with stubbing enabled. Because there is no current use case for deduplication without stubbing, an exception will be thrown to communicate the misconfiguration. --- .../jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt index 341d031183c..60b76e70029 100644 --- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt +++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt @@ -86,6 +86,15 @@ open class JvmIrCodegenFactory( IdeCodegenSettings(shouldStubAndNotLinkUnboundSymbols = shouldStubAndNotLinkUnboundSymbols), ) + init { + if (ideCodegenSettings.shouldDeduplicateBuiltInSymbols && !ideCodegenSettings.shouldStubAndNotLinkUnboundSymbols) { + throw IllegalStateException( + "`shouldDeduplicateBuiltInSymbols` depends on `shouldStubAndNotLinkUnboundSymbols` being enabled. Deduplication of" + + " built-in symbols hasn't been tested without stubbing and there is currently no use case for it without stubbing." + ) + } + } + /** * @param shouldStubOrphanedExpectSymbols See [stubOrphanedExpectSymbols]. * @param shouldDeduplicateBuiltInSymbols See [SymbolTableWithBuiltInsDeduplication].