JVM_IR: remove a suspend-related hack from BridgeLowering

`invoke` in suspend lambdas overrides FunctionN.invoke, so the
refactored BridgeLowering already generates correct bridges there.
All the hack does is break overrides of interface suspend methods.
This commit is contained in:
pyos
2020-02-18 10:59:09 +01:00
committed by Ilmir Usmanov
parent ba90e87756
commit 3080b4c435
8 changed files with 64 additions and 6 deletions
@@ -463,12 +463,7 @@ private class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass,
private fun IrValueParameter.copyWithTypeErasure(target: IrSimpleFunction, forceBoxing: Boolean = false): IrValueParameter = copyTo(
target, IrDeclarationOrigin.BRIDGE,
type =
// SuspendFunction{N} is Function{N+1} at runtime, thus, when we generate a bridge for suspend callable references,
// we need to replace the type of its continuation parameter with Any?
if (target.isSuspend && type.eraseTypeParameters().getClass()
?.fqNameWhenAvailable == DescriptorUtils.CONTINUATION_INTERFACE_FQ_NAME_RELEASE
) context.irBuiltIns.anyNType else type.eraseTypeParameters().let { if (forceBoxing) it.makeNullable() else it },
type = type.eraseTypeParameters().let { if (forceBoxing) it.makeNullable() else it },
varargElementType = varargElementType?.eraseTypeParameters()
)