From e1f3d5b37440bb852b5446fc2248eaffe93684bd Mon Sep 17 00:00:00 2001 From: Anders Fugmann Date: Tue, 6 Jan 2026 13:55:48 +0100 Subject: [PATCH] Kotlin: Do not skip writing of getter and setters if the local deligate is null --- .../src/main/kotlin/KotlinFileExtractor.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index baf0a838216..f83d887eb56 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -2979,19 +2979,19 @@ open class KotlinFileExtractor( // as a workaround to silence warnings for kotlin < 2.3 about the elvis // operator being redundant. // For Kotlin >= 2.3, the cast is redundant, so we need to silence that warning - @Suppress("USELESS_CAST") - val delegate = (s.delegate as IrVariable?) ?: run { - logger.errorElement("Local delegated property is missing delegate", s) - return - } - extractVariable(delegate, callable, blockId, 0) - + val delegate = s.delegate as IrVariable? val propId = tw.getFreshIdLabel() - tw.writeKtProperties(propId, s.name.asString()) - tw.writeHasLocation(propId, locId) - tw.writeKtPropertyDelegates(propId, useVariable(delegate)) + if (delegate == null) { + // This is not expected to happen, as the plugin hooks into the pipeline before IR lowering. + logger.errorElement("Local delegated property is missing delegate", s) + } else { + extractVariable(delegate, callable, blockId, 0) + tw.writeKtProperties(propId, s.name.asString()) + tw.writeHasLocation(propId, locId) + tw.writeKtPropertyDelegates(propId, useVariable(delegate)) + } // Getter: extractStatement(s.getter, callable, blockId, 1) val getterLabel = getLocallyVisibleFunctionLabels(s.getter).function