From 3766a5f2ad0303dc0216d70db8e2a1c6de415ce4 Mon Sep 17 00:00:00 2001 From: Sebastian Sellmair Date: Wed, 24 Jan 2024 15:52:29 +0100 Subject: [PATCH] [ObjCExport][Minor] Move 'isBinaryRepresentationNullable' utility to bottom of translateToObjCType.kt ^KT-65167 --- .../kotlin/objcexport/translateToObjCType.kt | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/native/objcexport-header-generator/impl/analysis-api/src/org/jetbrains/kotlin/objcexport/translateToObjCType.kt b/native/objcexport-header-generator/impl/analysis-api/src/org/jetbrains/kotlin/objcexport/translateToObjCType.kt index 9d445290932..b596b50bf80 100644 --- a/native/objcexport-header-generator/impl/analysis-api/src/org/jetbrains/kotlin/objcexport/translateToObjCType.kt +++ b/native/objcexport-header-generator/impl/analysis-api/src/org/jetbrains/kotlin/objcexport/translateToObjCType.kt @@ -46,21 +46,6 @@ internal fun KtType.translateToObjCType(typeBridge: TypeBridge): ObjCType { } } -context(KtAnalysisSession) -private fun KtType.isBinaryRepresentationNullable(): Boolean { - /* Convention to match K1 implementation */ - if (this is KtErrorType) return false - - if (fullyExpandedType.canBeNull) return true - - getInlineTargetTypeOrNull()?.let { inlineTargetType -> - if (inlineTargetType.canBeNull) return true - } - - return false -} - - /** * [org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportTranslatorImpl.mapReferenceType] */ @@ -179,6 +164,21 @@ private fun ObjCNonNullReferenceType.withNullabilityOf(kotlinType: KtType): ObjC } } +context(KtAnalysisSession) +private fun KtType.isBinaryRepresentationNullable(): Boolean { + /* Convention to match K1 implementation */ + if (this is KtErrorType) return false + + if (fullyExpandedType.canBeNull) return true + + getInlineTargetTypeOrNull()?.let { inlineTargetType -> + if (inlineTargetType.canBeNull) return true + } + + return false +} + + /** * Types to be "hidden" during mapping, i.e. represented as `id`. *