[IR] Don't pass originalCallee to the inliner
`originalCallee` is supposed to be the owner of the original call. It can be a fake override, and in the inliner we are using actual function with body. Apparently we can just stick with the resolved function. #KT-64807
This commit is contained in:
+4
-1
@@ -57,7 +57,10 @@ abstract class UsefulDeclarationProcessor(
|
||||
super.visitBlock(expression, data)
|
||||
|
||||
if (expression is IrReturnableBlock) {
|
||||
expression.inlineFunction?.addToUsefulPolyfilledDeclarations()
|
||||
// We need to extract `originalFunction` here because saved `inlineFunction`
|
||||
// is actually a copy made in `SaveInlineFunctionsBeforeInlining`.
|
||||
// Without this, we are not going to find proper intersection in the `saveOnlyIntersectionOfNextDeclarationsFor` method.
|
||||
expression.inlineFunction?.originalFunction?.addToUsefulPolyfilledDeclarations()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class FunctionInlining(
|
||||
?: containerScope?.irElement as? IrDeclarationParent
|
||||
?: (containerScope?.irElement as? IrDeclaration)?.parent
|
||||
|
||||
val inliner = Inliner(expression, actualCallee, target, currentScope ?: containerScope!!, parent, context)
|
||||
val inliner = Inliner(expression, actualCallee, currentScope ?: containerScope!!, parent, context)
|
||||
return inliner.inline().markAsRegenerated()
|
||||
}
|
||||
|
||||
@@ -149,7 +149,6 @@ class FunctionInlining(
|
||||
private inner class Inliner(
|
||||
val callSite: IrFunctionAccessExpression,
|
||||
val callee: IrFunction,
|
||||
val originalCallee: IrFunction,
|
||||
val currentScope: ScopeWithIr,
|
||||
val parent: IrDeclarationParent?,
|
||||
val context: CommonBackendContext
|
||||
@@ -169,7 +168,7 @@ class FunctionInlining(
|
||||
|
||||
val substituteMap = mutableMapOf<IrValueParameter, IrExpression>()
|
||||
|
||||
fun inline() = inlineFunction(callSite, callee, originalCallee, true)
|
||||
fun inline() = inlineFunction(callSite, callee, callee, true)
|
||||
|
||||
private fun <E : IrElement> E.copy(): E {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
||||
Reference in New Issue
Block a user