From 06680452dcbe2a5a9a70c8afb4587d3e34f39532 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Tue, 8 Sep 2020 13:40:31 +0200 Subject: [PATCH] [JVM_IR] Always look for default lambdas in the inliner. This allows compiler plugins such as Compose to do custom default argument handling in methods that do not have origin `FUNCTION_FOR_DEFAULT_PARAMETER`. The code still bails out early is there is not defaults mask, so there should be no compile-time penalty. --- .../jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt index d56ea8bb65d..742c471eefa 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCodegen.kt @@ -157,7 +157,8 @@ class IrInlineCodegen( try { performInline( expression.symbol.owner.typeParameters.map { it.symbol }, - function.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER, + // Always look for default lambdas to allow custom default argument handling in compiler plugins. + true, false, codegen.typeMapper.typeSystem, registerLineNumberAfterwards = false, @@ -186,6 +187,7 @@ class IrInlineCodegen( } override fun extractDefaultLambdas(node: MethodNode): List { + if (maskStartIndex == -1) return listOf() return expandMaskConditionsAndUpdateVariableNodes( node, maskStartIndex, maskValues, methodHandleInDefaultMethodIndex, extractDefaultLambdaOffsetAndDescriptor(jvmSignature, function),