[K/N][IR] Removed unnecessary hack

The hack has been rendered redundant due to the recent fixes in psi2ir
This commit is contained in:
Igor Chevdar
2021-03-22 20:25:04 +05:00
parent 246a907753
commit a618791ff0
@@ -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)
}