diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 6b007454e2d..af45214f35d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -1447,9 +1447,6 @@ public class ExpressionCodegen extends KtVisitor impleme leaveTasks.add(answer -> { int index = myFrameMap.leave(functionDescriptor); - assert !functionDescriptor.getName().isSpecial() - : "Local variable should be generated only for function with name: " + localFunction.getText(); - String functionIndex = StringsKt.substringAfterLast(type.getInternalName(), '$', ""); assert !functionIndex.isEmpty(); diff --git a/compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt b/compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt new file mode 100644 index 00000000000..b1cc8d2e895 --- /dev/null +++ b/compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt @@ -0,0 +1,9 @@ +fun block(block: () -> T): T = block() +fun foo() {} + +fun test(): () -> Unit = block { fun() = foo() } + +fun box(): String { + test() + return "OK" +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 69fad507969..a47c9e1b344 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -11591,6 +11591,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt"); } + @TestMetadata("insideGenericLambda.kt") + public void testInsideGenericLambda() throws Exception { + runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt"); + } + @TestMetadata("underscoreParameters.kt") public void testUnderscoreParameters() throws Exception { runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 489662cac5c..8ca4585acbf 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11591,6 +11591,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt"); } + @TestMetadata("insideGenericLambda.kt") + public void testInsideGenericLambda() throws Exception { + runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt"); + } + @TestMetadata("underscoreParameters.kt") public void testUnderscoreParameters() throws Exception { runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 74dd1d562b3..d531e60cabb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -10471,6 +10471,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt"); } + @TestMetadata("insideGenericLambda.kt") + public void testInsideGenericLambda() throws Exception { + runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt"); + } + @TestMetadata("underscoreParameters.kt") public void testUnderscoreParameters() throws Exception { runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 5d6bc3f7d77..ca2ca89f035 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -9016,6 +9016,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt"); } + @TestMetadata("insideGenericLambda.kt") + public void testInsideGenericLambda() throws Exception { + runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt"); + } + @TestMetadata("underscoreParameters.kt") public void testUnderscoreParameters() throws Exception { runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 2ae0abe1a2e..e91a61cae49 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10101,6 +10101,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt"); } + @TestMetadata("insideGenericLambda.kt") + public void testInsideGenericLambda() throws Exception { + runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt"); + } + @TestMetadata("underscoreParameters.kt") public void testUnderscoreParameters() throws Exception { runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");