From 3ae084b1b3dd29dc121e338effd11cc43b18983c Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Tue, 8 Aug 2017 13:32:04 +0200 Subject: [PATCH] Get rid of reification from 'deepCopyWithVariables' --- .../backend/common/DeepCopyIrTreeWithDeclarations.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDeclarations.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDeclarations.kt index c7f69b754e4..4db51b21b13 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDeclarations.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDeclarations.kt @@ -24,7 +24,8 @@ import org.jetbrains.kotlin.ir.util.DeepCopySymbolsRemapper import org.jetbrains.kotlin.ir.util.DescriptorsRemapper import org.jetbrains.kotlin.ir.visitors.acceptVoid -fun IrElement.deepCopyWithVariablesImpl(): IrElement { +@Suppress("UNCHECKED_CAST") +fun T.deepCopyWithVariables(): T { val descriptorsRemapper = object : DescriptorsRemapper { override fun remapDeclaredVariable(descriptor: VariableDescriptor) = LocalVariableDescriptor( /* containingDeclaration = */ descriptor.containingDeclaration, @@ -47,8 +48,5 @@ fun IrElement.deepCopyWithVariablesImpl(): IrElement { } }, null - ) -} - -inline fun T.deepCopyWithVariables(): T = - this.deepCopyWithVariablesImpl() as T \ No newline at end of file + ) as T +} \ No newline at end of file