Callable reference type does not coincides with descriptor return type

Callable reference should be excluded from parameter evaluation procedure
This commit is contained in:
Konstantin Anisimov
2017-04-18 10:38:49 +07:00
committed by KonstantinAnisimov
parent 7bf9669f57
commit 8db33dd530
2 changed files with 2 additions and 1 deletions
@@ -425,7 +425,7 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: DeclarationDe
return IrCallableReferenceImpl(
startOffset = expression.startOffset,
endOffset = expression.endOffset,
type = newDescriptor.returnType!!,
type = expression.type,
descriptor = newDescriptor,
typeArguments = expression.getTypeArgumentsMap(),
origin = mapStatementOrigin(expression.origin)
@@ -217,6 +217,7 @@ private class Inliner(val currentScope: ScopeWithIr, val context: Context) {
private fun argumentNeedsEvaluation(expression: IrExpression): Boolean {
if (expression is IrGetValue) return false // Parameter is already GetValue - nothing to evaluate.
if (expression is IrConst<*>) return false // Parameter is constant - nothing to evaluate.
if (expression is IrCallableReference) return false // Parameter is callable reference - nothing to evaluate.
if (isLambdaExpression(expression)) return false // Parameter is lambda - will be inlined.
return true
}