From 36935702b9da1bbc2ad876370f4eb5987fc0d7e0 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 26 Oct 2022 18:50:08 +0400 Subject: [PATCH] [JS IR] Make cast in bridge nullable in case of default parameter method --- .../ir/backend/js/lower/JsDefaultArgumentFunctionFactory.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentFunctionFactory.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentFunctionFactory.kt index 36f278669b7..e4d35c2fd4f 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentFunctionFactory.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultArgumentFunctionFactory.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.types.makeNullable import org.jetbrains.kotlin.ir.util.copyTypeParametersFrom import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.isTopLevel @@ -31,7 +32,7 @@ class JsDefaultArgumentFunctionFactory(override val context: JsIrBackendContext) private fun IrFunction.introduceContextParam() = addValueParameter { name = Name.identifier("\$super") - type = parentAsClass.defaultType + type = parentAsClass.defaultType.makeNullable() origin = JsLoweredDeclarationOrigin.JS_SUPER_CONTEXT_PARAMETER }