Lowerings: Don't change visibility of local declarations extracted from inlinable lambdas

^KT-80653 Fixed
diff --git a/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxTestGenerated.java b/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxTestGenerated.java
index 016dcac..d83e8a7 100644
--- a/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxTestGenerated.java
+++ b/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxTestGenerated.java
@@ -25070,12 +25070,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxTestGenerated.java b/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxTestGenerated.java
index 55e2aab..a4a11d7 100644
--- a/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxTestGenerated.java
+++ b/analysis/low-level-api-fir/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxTestGenerated.java
@@ -25070,12 +25070,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java
index e51c39a..0800990 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java
@@ -24909,12 +24909,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java
index 1be28fb..c090b05 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java
@@ -24953,12 +24953,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java
index 5d7eaed..c8025e7 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java
@@ -24909,12 +24909,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java
index 0eae47e..d2fe304 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java
@@ -24953,12 +24953,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt
index 8d82f0d..801f39b 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt
@@ -37,14 +37,12 @@
 import org.jetbrains.kotlin.utils.memoryOptimizedMap
 
 interface VisibilityPolicy {
-    fun forClass(declaration: IrClass, inInlineFunctionScope: Boolean): DescriptorVisibility =
-        DescriptorVisibilities.PRIVATE
+    fun forClass(declaration: IrClass, inInlineFunctionScope: Boolean): DescriptorVisibility = DescriptorVisibilities.PRIVATE
+    fun forConstructor(declaration: IrConstructor, inInlineFunctionScope: Boolean): DescriptorVisibility = DescriptorVisibilities.PRIVATE
+    fun forCapturedField(value: IrValueSymbol): DescriptorVisibility = DescriptorVisibilities.PRIVATE
 
-    fun forConstructor(declaration: IrConstructor, inInlineFunctionScope: Boolean): DescriptorVisibility =
-        DescriptorVisibilities.PRIVATE
-
-    fun forCapturedField(value: IrValueSymbol): DescriptorVisibility =
-        DescriptorVisibilities.PRIVATE
+    fun forSimpleFunction(declaration: IrSimpleFunction, ownerIsLocal: Boolean): DescriptorVisibility =
+        if (ownerIsLocal) DescriptorVisibilities.LOCAL else DescriptorVisibilities.PRIVATE
 
     companion object {
         val DEFAULT = object : VisibilityPolicy {}
@@ -828,7 +826,7 @@
             val newDeclaration = context.irFactory.buildFun {
                 updateFrom(oldDeclaration)
                 name = oldDeclaration.inventedNameForLocalFunction ?: oldDeclaration.name
-                visibility = if (owner.isLocal) DescriptorVisibilities.LOCAL else DescriptorVisibilities.PRIVATE
+                visibility = visibilityPolicy.forSimpleFunction(oldDeclaration, owner.isLocal)
                 modality = Modality.FINAL
             }
 
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/LocalClasses.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/LocalClasses.kt
index 7923eca..ad722c1 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/LocalClasses.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/LocalClasses.kt
@@ -12,7 +12,6 @@
 import org.jetbrains.kotlin.backend.common.lower.VisibilityPolicy
 import org.jetbrains.kotlin.backend.common.phaser.PhaseDescription
 import org.jetbrains.kotlin.backend.common.runOnFilePostfix
-import org.jetbrains.kotlin.descriptors.DescriptorVisibility
 import org.jetbrains.kotlin.ir.IrElement
 import org.jetbrains.kotlin.ir.IrStatement
 import org.jetbrains.kotlin.ir.declarations.*
@@ -108,13 +107,13 @@
                     context,
                     visibilityPolicy = object : VisibilityPolicy {
                         /**
-                         * Local classes extracted from inline lambdas are not yet lifted, so their visibility should remain local.
-                         * They will be visited for the second time _after_ function inlining, and only then will they be lifted to
-                         * the nearest declaration container by [LocalDeclarationPopupLowering],
+                         * Local classes and local functions extracted from inline lambdas are not yet lifted,
+                         * so their visibility should remain unchanged. They will be visited for the second time on the second compilation
+                         * stage, and only then will they be lifted to the nearest declaration container by [LocalDeclarationPopupLowering],
                          * so that's when we will change their visibility to private.
                          */
-                        override fun forClass(declaration: IrClass, inInlineFunctionScope: Boolean): DescriptorVisibility =
-                            declaration.visibility
+                        override fun forClass(declaration: IrClass, inInlineFunctionScope: Boolean) = declaration.visibility
+                        override fun forSimpleFunction(declaration: IrSimpleFunction, ownerIsLocal: Boolean) = declaration.visibility
                     },
                     // Lambdas cannot introduce new type parameters to the scope, which means that all the captured type parameters
                     // are also present in the inline lambda's parent declaration,
diff --git a/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambda.kt b/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambda.kt
index a826ea2..aa02422 100644
--- a/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambda.kt
+++ b/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambda.kt
@@ -1,4 +1,3 @@
-// LANGUAGE: -IrIntraModuleInlinerBeforeKlibSerialization, -IrCrossModuleInlinerBeforeKlibSerialization
 // NO_CHECK_LAMBDA_INLINING
 
 // FILE: lib.kt
diff --git a/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt b/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt
deleted file mode 100644
index c0878fb..0000000
--- a/compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-// LANGUAGE: +IrIntraModuleInlinerBeforeKlibSerialization, +IrCrossModuleInlinerBeforeKlibSerialization
-// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM, NATIVE
-// ^^^KT-80653 Internal error in body lowering: java.lang.IllegalStateException: Local declarations should've been popped out by this point
-// NO_CHECK_LAMBDA_INLINING
-
-// FILE: lib.kt
-inline fun <R> myRun(block: () -> R): R {
-    return block()
-}
-
-// FILE: main.kt
-fun box() = myRun {
-    object {
-        fun foo(): String {
-            fun localFun() = "OK"
-            return localFun()
-        }
-    }.foo()
-}
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java
index 2e010781..595c267 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java
@@ -24909,12 +24909,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java
index e6897fe..01ab78c 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java
@@ -24909,12 +24909,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java
index cd9066f..b94a9cc 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java
@@ -24909,12 +24909,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirSerializeCompileKotlinAgainstInlineKotlinTestWithInlineScopesGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirSerializeCompileKotlinAgainstInlineKotlinTestWithInlineScopesGenerated.java
index 521127e..b78fc3a 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirSerializeCompileKotlinAgainstInlineKotlinTestWithInlineScopesGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirSerializeCompileKotlinAgainstInlineKotlinTestWithInlineScopesGenerated.java
@@ -24953,12 +24953,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerFirstPhaseTestGenerated.java b/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerFirstPhaseTestGenerated.java
index fad73d2..9c01904 100644
--- a/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerFirstPhaseTestGenerated.java
+++ b/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerFirstPhaseTestGenerated.java
@@ -18784,12 +18784,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerSecondPhaseTestGenerated.java b/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerSecondPhaseTestGenerated.java
index 6a73bb3..3cdfe8d 100644
--- a/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerSecondPhaseTestGenerated.java
+++ b/js/js.tests/klib-compatibility/tests-gen/org/jetbrains/kotlin/js/test/klib/CustomJsCompilerSecondPhaseTestGenerated.java
@@ -18784,12 +18784,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java
index 35012ed..81148a4 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java
@@ -18579,12 +18579,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxWithInlinedFunInKlibTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxWithInlinedFunInKlibTestGenerated.java
index 039e2fd..9669fea 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxWithInlinedFunInKlibTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxWithInlinedFunInKlibTestGenerated.java
@@ -18581,12 +18581,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenSplittingInlineWithInlinedFunInKlibTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenSplittingInlineWithInlinedFunInKlibTestGenerated.java
index 93a30f1..9e03647 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenSplittingInlineWithInlinedFunInKlibTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenSplittingInlineWithInlinedFunInKlibTestGenerated.java
@@ -19169,12 +19169,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java
index 7ac3dde..5507b12 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java
@@ -18781,12 +18781,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java
index c268006..075b8d1 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java
@@ -18781,12 +18781,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java
index 7f5ef0e..be106f5 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java
@@ -18982,12 +18982,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxTestGenerated.java
index 6a91bb3..8878b03 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxTestGenerated.java
@@ -18581,12 +18581,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxWithInlinedFunInKlibTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxWithInlinedFunInKlibTestGenerated.java
index 15fdd04..0866d87 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxWithInlinedFunInKlibTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrDeserializationCodegenBoxWithInlinedFunInKlibTestGenerated.java
@@ -18581,12 +18581,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java
index 8b2bc7a..9fece1e 100644
--- a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java
+++ b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java
@@ -19598,12 +19598,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java
index 8eda30c..a6ce150 100644
--- a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java
+++ b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java
@@ -20028,12 +20028,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java
index 1470fd2..0e2f4c2 100644
--- a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java
+++ b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java
@@ -19813,12 +19813,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java
index 342a5e3..f8e9456 100644
--- a/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java
+++ b/native/native.tests/codegen-box/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java
@@ -20243,12 +20243,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxWithInlinedFunInKlibTestGenerated.java b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxWithInlinedFunInKlibTestGenerated.java
index f09fe3b..30b12d4 100644
--- a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxWithInlinedFunInKlibTestGenerated.java
+++ b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxWithInlinedFunInKlibTestGenerated.java
@@ -19598,12 +19598,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationTestGenerated.java b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationTestGenerated.java
index e302dd6..18e3e7d 100644
--- a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationTestGenerated.java
+++ b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationTestGenerated.java
@@ -19151,12 +19151,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationWithInlinedFunInKlibTestGenerated.java b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationWithInlinedFunInKlibTestGenerated.java
index e18715e..530c8ff 100644
--- a/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationWithInlinedFunInKlibTestGenerated.java
+++ b/native/native.tests/klib-ir-inliner/tests-gen/org/jetbrains/kotlin/konan/test/serialization/NativeIrDeserializationWithInlinedFunInKlibTestGenerated.java
@@ -19151,12 +19151,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java
index 9148e71..6d613d1 100644
--- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java
@@ -18561,12 +18561,6 @@
       }
 
       @Test
-      @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-      public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-        runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-      }
-
-      @Test
       @TestMetadata("localExtensionOnNullableParameter.kt")
       public void testLocalExtensionOnNullableParameter() {
         runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxWithInlinedFunInKlibTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxWithInlinedFunInKlibTestGenerated.java
index 9e0e156..9121488 100644
--- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxWithInlinedFunInKlibTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxWithInlinedFunInKlibTestGenerated.java
@@ -18563,12 +18563,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");
diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenSplittingWithInlinedFunInKlibTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenSplittingWithInlinedFunInKlibTestGenerated.java
index 7863f9b..126a78c 100644
--- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenSplittingWithInlinedFunInKlibTestGenerated.java
+++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenSplittingWithInlinedFunInKlibTestGenerated.java
@@ -18563,12 +18563,6 @@
         }
 
         @Test
-        @TestMetadata("liftThroughFunObjectLambdaWithInlinedFunInKlib.kt")
-        public void testLiftThroughFunObjectLambdaWithInlinedFunInKlib() {
-          runTest("compiler/testData/codegen/box/functions/localFunctions/liftThroughFunObjectLambdaWithInlinedFunInKlib.kt");
-        }
-
-        @Test
         @TestMetadata("localExtensionOnNullableParameter.kt")
         public void testLocalExtensionOnNullableParameter() {
           runTest("compiler/testData/codegen/box/functions/localFunctions/localExtensionOnNullableParameter.kt");