interface IrType { } interface TypeRemapper { abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer) abstract fun remapType(type: IrType): IrType abstract fun leaveScope() } interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent { abstract var typeParameters: List abstract get abstract set } interface IrDeclaration { } interface IrTypeParameter : IrDeclaration { abstract val superTypes: MutableList abstract get } interface IrDeclarationParent { } class DeepCopyIrTreeWithSymbols { constructor(typeRemapper: TypeRemapper) /* primary */ { super/*Any*/() /* () */ } private val typeRemapper: TypeRemapper field = typeRemapper private get private fun copyTypeParameter(declaration: IrTypeParameter): IrTypeParameter { return declaration } fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) { .( = other.().map(transform = local fun (it: IrTypeParameter): IrTypeParameter { return .copyTypeParameter(declaration = it) } )) .().withinScope(irTypeParametersContainer = , fn = local fun () { { // BLOCK val tmp0_iterator: Iterator> = .().zip(other = other.()).iterator() while (tmp0_iterator.hasNext()) { // BLOCK val tmp1_loop_parameter: Pair = tmp0_iterator.next() val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1() val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2() { // BLOCK otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { return .().remapType(type = it) } ) /*~> Unit */ } } } } ) } } inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrTypeParametersContainer, fn: Function0): T { .enterScope(irTypeParametersContainer = irTypeParametersContainer) val result: T = fn.invoke() .leaveScope() return result }