IR: Fixed bug with dispatch receiver parameter

When building dispatch receiver for newly created functions
take ReceiverParameter from the parent class rather than create new
This commit is contained in:
Igor Chevdar
2019-01-14 18:42:18 +03:00
parent 22f77134b0
commit 6220291ef8
@@ -211,21 +211,18 @@ fun IrClass.createParameterDeclarations() {
fun IrFunction.createDispatchReceiverParameter(origin: IrDeclarationOrigin? = null) { fun IrFunction.createDispatchReceiverParameter(origin: IrDeclarationOrigin? = null) {
assert(dispatchReceiverParameter == null) assert(dispatchReceiverParameter == null)
dispatchReceiverParameter = WrappedReceiverParameterDescriptor().let { dispatchReceiverParameter = IrValueParameterImpl(
IrValueParameterImpl( startOffset, endOffset,
startOffset, endOffset, origin ?: parentAsClass.origin,
origin ?: parentAsClass.origin, IrValueParameterSymbolImpl(parentAsClass.thisReceiver!!.descriptor),
IrValueParameterSymbolImpl(it), Name.special("<this>"),
Name.special("<this>"), 0,
0, parentAsClass.defaultType,
parentAsClass.defaultType, null,
null, false,
false, false
false ).apply {
).apply { parent = this@createDispatchReceiverParameter
it.bind(this)
parent = this@createDispatchReceiverParameter
}
} }
} }