[JS IR] Remove redundant guard assertion for extension funs with default params

Introduce corresponding test
See https://youtrack.jetbrains.com/issue/KT-41076
This commit is contained in:
Shagen Ogandzhanian
2020-12-02 16:45:12 +01:00
parent a917ebd11e
commit d512158c25
9 changed files with 77 additions and 3 deletions
@@ -37,11 +37,12 @@ class JsDefaultArgumentStubGenerator(override val context: JsIrBackendContext) :
): IrExpression {
val paramCount = oldIrFunction.valueParameters.size
val invokeFunctionN = resolveInvoke(paramCount)
// NOTE: currently we do not have a syntax to perform super extension call
// but in case we have such functionality in the future the logic bellow should be fixed
return irCall(invokeFunctionN, IrStatementOrigin.INVOKE).apply {
dispatchReceiver = irImplicitCast(irGet(handlerDeclaration), invokeFunctionN.dispatchReceiverParameter!!.type)
assert(newIrFunction.extensionReceiverParameter == null)
// NOTE: currently we do not have a syntax to perform super extension call
// that's why we've used to just fail with an exception in case we have extension function in for JS IR compilation
// TODO: that was overkill, however, we still need to revisit this issue later on
params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) }
}
}