From 7aed8d2f75a5cd6122d64eb7e332b02e3ee015be Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Wed, 22 May 2019 18:16:24 +0300 Subject: [PATCH] [JS IR BE] Fix lowering types nullability --- .../backend/common/lower/DefaultArgumentStubGenerator.kt | 2 +- .../kotlin/ir/backend/js/lower/CallableReferenceLowering.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt index 9b7ac51744c..0a5506b9ae9 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt @@ -426,7 +426,7 @@ private fun IrFunction.generateDefaultsFunctionImpl( syntheticParameters += newFunction.valueParameter( syntheticParameters.last().index + 1, "handler".synthesizedName, - context.irBuiltIns.anyType + context.irBuiltIns.anyNType ) } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt index 69b480a3660..344b09fca64 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeProjection import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl +import org.jetbrains.kotlin.ir.types.makeNullable import org.jetbrains.kotlin.ir.util.isInlined import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid @@ -326,7 +327,7 @@ class CallableReferenceLowering(val context: JsIrBackendContext) : FileLoweringP // } // val cacheName = "${factoryFunction.name}_${Namer.KCALLABLE_CACHE_SUFFIX}" - val type = factoryFunction.returnType + val type = factoryFunction.returnType.makeNullable() val irNull = { JsIrBuilder.buildNull(context.irBuiltIns.nothingNType) } val cacheVar = JsIrBuilder.buildVar(type, factoryFunction.parent, cacheName, true, initializer = irNull())