From d49023e172c27bdb62b4c2878616bd0c5411bccf Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 9 Mar 2017 11:52:29 +0700 Subject: [PATCH] backend: fix `null` type in default arguments lowering --- .../kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt index dabbd900231..05b937b8070 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.typeUtil.builtIns import org.jetbrains.kotlin.utils.addToStdlib.singletonList class DefaultArgumentStubGenerator internal constructor(val context: Context): DeclarationContainerLoweringPass { @@ -205,7 +206,7 @@ private fun nullConst(expression: IrElement, type: KotlinType): IrExpression? { KotlinBuiltIns.isShort(type) -> return IrConstImpl.short (expression.startOffset, expression.endOffset, type, 0) KotlinBuiltIns.isInt(type) -> return IrConstImpl.int (expression.startOffset, expression.endOffset, type, 0) KotlinBuiltIns.isLong(type) -> return IrConstImpl.long (expression.startOffset, expression.endOffset, type, 0) - else -> return IrConstImpl.constNull (expression.startOffset, expression.endOffset, type) + else -> return IrConstImpl.constNull (expression.startOffset, expression.endOffset, type.builtIns.nullableNothingType) } }