From a618791ff0294885fefbb5233278620c2c1135f5 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Mon, 22 Mar 2021 20:25:04 +0500 Subject: [PATCH] [K/N][IR] Removed unnecessary hack The hack has been rendered redundant due to the recent fixes in psi2ir --- .../konan/lower/FunctionReferenceLowering.kt | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionReferenceLowering.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionReferenceLowering.kt index 3ac0206c666..399e7786521 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionReferenceLowering.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionReferenceLowering.kt @@ -32,13 +32,10 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl import org.jetbrains.kotlin.ir.symbols.impl.IrConstructorSymbolImpl import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl import org.jetbrains.kotlin.ir.types.* -import org.jetbrains.kotlin.ir.types.impl.buildSimpleType -import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.Variance internal class FunctionReferenceLowering(val context: Context): FileLoweringPass { @@ -92,21 +89,6 @@ internal class FunctionReferenceLowering(val context: Context): FileLoweringPass return result } - // TODO: Move to common IR utils. - fun IrType.eraseProjections(): IrType { - if (this !is IrSimpleType) return this - return buildSimpleType { - this.classifier = this@eraseProjections.classifier - this.hasQuestionMark = this@eraseProjections.hasQuestionMark - this.annotations = this@eraseProjections.annotations - this.arguments = this@eraseProjections.arguments.map { - if (it !is IrTypeProjection) - it - else makeTypeProjection(it.type.eraseProjections(), Variance.INVARIANT) - } - } - } - // Handle SAM conversions which wrap a function reference: // class sam$n(private val receiver: R) : Interface { override fun method(...) = receiver.target(...) } // @@ -129,7 +111,7 @@ internal class FunctionReferenceLowering(val context: Context): FileLoweringPass return super.visitTypeOperator(expression) } reference.transformChildrenVoid() - return transformFunctionReference(reference, expression.typeOperand.eraseProjections()) + return transformFunctionReference(reference, expression.typeOperand) } return super.visitTypeOperator(expression) }