Forbid local properties with private accessors in public inline function

Public inline functions should not have local delegated properties with
private access functions as it leads to accessibility problems on the
call-site of inline function.

Report such code as
DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS for language versions up to
2.0, and NON_PUBLIC_CALL_FROM_PUBLIC_INLINE for versions 2.1 and later.
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java
index 126890a..df741c9 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java
@@ -18625,6 +18625,18 @@
             }
 
             @Test
+            @TestMetadata("localDelegatedPropertiesInInlineError.kt")
+            public void testLocalDelegatedPropertiesInInlineError() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt");
+            }
+
+            @Test
+            @TestMetadata("localDelegatedPropertiesInInlineWarning.kt")
+            public void testLocalDelegatedPropertiesInInlineWarning() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt");
+            }
+
+            @Test
             @TestMetadata("localFun.kt")
             public void testLocalFun() throws Exception {
                 runTest("compiler/testData/diagnostics/tests/inline/localFun.kt");
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java
index 7c9cf91..ad7e00b 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java
@@ -18625,6 +18625,18 @@
             }
 
             @Test
+            @TestMetadata("localDelegatedPropertiesInInlineError.kt")
+            public void testLocalDelegatedPropertiesInInlineError() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt");
+            }
+
+            @Test
+            @TestMetadata("localDelegatedPropertiesInInlineWarning.kt")
+            public void testLocalDelegatedPropertiesInInlineWarning() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt");
+            }
+
+            @Test
             @TestMetadata("localFun.kt")
             public void testLocalFun() throws Exception {
                 runTest("compiler/testData/diagnostics/tests/inline/localFun.kt");
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java
index 855e8a0..509574b 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java
@@ -18625,6 +18625,18 @@
             }
 
             @Test
+            @TestMetadata("localDelegatedPropertiesInInlineError.kt")
+            public void testLocalDelegatedPropertiesInInlineError() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt");
+            }
+
+            @Test
+            @TestMetadata("localDelegatedPropertiesInInlineWarning.kt")
+            public void testLocalDelegatedPropertiesInInlineWarning() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt");
+            }
+
+            @Test
             @TestMetadata("localFun.kt")
             public void testLocalFun() throws Exception {
                 runTest("compiler/testData/diagnostics/tests/inline/localFun.kt");
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java
index 860cacc..0aee20a 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java
@@ -18631,6 +18631,18 @@
             }
 
             @Test
+            @TestMetadata("localDelegatedPropertiesInInlineError.kt")
+            public void testLocalDelegatedPropertiesInInlineError() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt");
+            }
+
+            @Test
+            @TestMetadata("localDelegatedPropertiesInInlineWarning.kt")
+            public void testLocalDelegatedPropertiesInInlineWarning() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt");
+            }
+
+            @Test
             @TestMetadata("localFun.kt")
             public void testLocalFun() throws Exception {
                 runTest("compiler/testData/diagnostics/tests/inline/localFun.kt");
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt
index 190187d..1c72e70 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt
@@ -58,6 +58,7 @@
     DataObjectContentChecker,
     EnumEntriesRedeclarationChecker,
     VolatileAnnotationChecker,
+    LocalDelegatedPropertiesInInlineFunctionsChecker
 )
 
 private val DEFAULT_CALL_CHECKERS = listOf(
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LocalDelegatedPropertiesInInlineFunctionsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LocalDelegatedPropertiesInInlineFunctionsChecker.kt
new file mode 100644
index 0000000..242d6f9
--- /dev/null
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/LocalDelegatedPropertiesInInlineFunctionsChecker.kt
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+package org.jetbrains.kotlin.resolve.calls.checkers
+
+import org.jetbrains.kotlin.config.LanguageFeature
+import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
+import org.jetbrains.kotlin.descriptors.FunctionDescriptor
+import org.jetbrains.kotlin.descriptors.effectiveVisibility
+import org.jetbrains.kotlin.descriptors.impl.LocalVariableAccessorDescriptor
+import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
+import org.jetbrains.kotlin.diagnostics.Errors
+import org.jetbrains.kotlin.psi.KtDeclaration
+import org.jetbrains.kotlin.psi.KtElement
+import org.jetbrains.kotlin.resolve.BindingContext
+import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker
+import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
+import org.jetbrains.kotlin.resolve.inline.InlineUtil
+
+object LocalDelegatedPropertiesInInlineFunctionsChecker : DeclarationChecker {
+
+    override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
+        if (descriptor !is LocalVariableDescriptor) return
+        val inlineFunctionDescriptor = generateSequence(descriptor as DeclarationDescriptor) { descriptor.containingDeclaration }
+            .firstOrNull { InlineUtil.isInline(it) } as? FunctionDescriptor ?: return
+        if (!inlineFunctionDescriptor.effectiveVisibility(checkPublishedApi = true).publicApi) return
+        val delegateExpression =
+            context.trace.bindingContext.get(BindingContext.DELEGATED_PROPERTY_CALL, descriptor.getter)?.callElement ?: return
+        checkAndReportIfCallsNonPublishedApi(descriptor.getter, delegateExpression, inlineFunctionDescriptor, context)
+        checkAndReportIfCallsNonPublishedApi(descriptor.setter, delegateExpression, inlineFunctionDescriptor, context)
+    }
+
+    private fun checkAndReportIfCallsNonPublishedApi(
+        accessor: LocalVariableAccessorDescriptor?,
+        delegatedExpression: KtElement,
+        inlineFunctionDescriptor: FunctionDescriptor,
+        context: DeclarationCheckerContext,
+    ) {
+        val reportError =
+            context.languageVersionSettings.supportsFeature(
+                LanguageFeature.ForbidLocalDelegatedPropertiesWithPrivateAccessorsInPublicInlineFunctions
+            )
+        val delegatedDescriptor =
+            context.trace.bindingContext.get(BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, accessor)?.resultingDescriptor ?: return
+        if (!delegatedDescriptor.effectiveVisibility(checkPublishedApi = true).publicApi) {
+            if (reportError) {
+                context.trace.report(
+                    Errors.NON_PUBLIC_CALL_FROM_PUBLIC_INLINE.on(
+                        delegatedExpression,
+                        delegatedDescriptor,
+                        inlineFunctionDescriptor
+                    )
+                )
+            } else {
+                context.trace.report(Errors.DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS.on(delegatedExpression))
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt b/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt
new file mode 100644
index 0000000..d303fa2
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt
@@ -0,0 +1,96 @@
+// !DIAGNOSTICS: -NOTHING_TO_INLINE
+// FIR_IDENTICAL
+// LANGUAGE: +ForbidLocalDelegatedPropertiesWithPrivateAccessorsInPublicInlineFunctions
+
+import kotlin.reflect.KProperty
+
+@PublishedApi
+internal class A {
+    internal operator fun getValue(nothing: Any?, property: KProperty<*>): String = ""
+}
+
+@PublishedApi
+internal class B {
+    operator fun getValue(nothing: Any?, property: KProperty<*>): String = ""
+}
+
+class C {
+    internal operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+class D {
+    @PublishedApi
+    internal operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+class E {
+    operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+private operator fun Int.getValue(nothing: Any?, property: KProperty<*>) = ""
+internal operator fun Boolean.getValue(nothing: Any?, property: KProperty<*>) = ""
+operator fun Double.getValue(nothing: Any?, property: KProperty<*>) = ""
+
+@PublishedApi
+internal operator fun Char.getValue(nothing: Any?, property: KProperty<*>) = ""
+
+private operator fun String.setValue(nothing: Any?, property: KProperty<*>, any: Any) = "OK"
+operator fun String.getValue(nothing: Any?, property: KProperty<*>) = "OK"
+
+private inline fun privateInlineFun() {
+    val a by A()
+    val b by B()
+    val c by C()
+    val d by D()
+    val e by E()
+    val f by 1
+    val g by true
+    val h by 1.0
+    val i by 'a'
+    var j by ""
+    val k by ""
+}
+
+internal inline fun internalInlineFun() {
+    val a by A()
+    val b by B()
+    val c by C()
+    val d by D()
+    val e by E()
+    val f by 1
+    val g by true
+    val h by 1.0
+    val i by 'a'
+    var j by ""
+    val k by ""
+}
+
+inline fun publicInlineFun() {
+    val a by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>A<!>()
+    val b by B()
+    val c by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>C<!>()
+    val d by D()
+    val e by E()
+    val f by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>1<!>
+    val g by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>true<!>
+    val h by 1.0
+    val i by 'a'
+    var j by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>""<!>
+    val k by ""
+}
+
+@PublishedApi
+internal inline fun publishedApiInlineFun() {
+    val a by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>A<!>()
+    val b by B()
+    val c by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>C<!>()
+    val d by D()
+    val e by E()
+    val f by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>1<!>
+    val g by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>true<!>
+    val h by 1.0
+    val i by 'a'
+    var j by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>""<!>
+    val k by ""
+}
+
diff --git a/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.fir.kt b/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.fir.kt
new file mode 100644
index 0000000..7fba97d
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.fir.kt
@@ -0,0 +1,95 @@
+// !DIAGNOSTICS: -NOTHING_TO_INLINE
+// LANGUAGE: -ForbidLocalDelegatedPropertiesWithPrivateAccessorsInPublicInlineFunctions
+
+import kotlin.reflect.KProperty
+
+@PublishedApi
+internal class A {
+    internal operator fun getValue(nothing: Any?, property: KProperty<*>): String = ""
+}
+
+@PublishedApi
+internal class B {
+    operator fun getValue(nothing: Any?, property: KProperty<*>): String = ""
+}
+
+class C {
+    internal operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+class D {
+    @PublishedApi
+    internal operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+class E {
+    operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+private operator fun Int.getValue(nothing: Any?, property: KProperty<*>) = ""
+internal operator fun Boolean.getValue(nothing: Any?, property: KProperty<*>) = ""
+operator fun Double.getValue(nothing: Any?, property: KProperty<*>) = ""
+
+@PublishedApi
+internal operator fun Char.getValue(nothing: Any?, property: KProperty<*>) = ""
+
+private operator fun String.setValue(nothing: Any?, property: KProperty<*>, any: Any) = "OK"
+operator fun String.getValue(nothing: Any?, property: KProperty<*>) = "OK"
+
+private inline fun privateInlineFun() {
+    val a by A()
+    val b by B()
+    val c by C()
+    val d by D()
+    val e by E()
+    val f by 1
+    val g by true
+    val h by 1.0
+    val i by 'a'
+    var j by ""
+    val k by ""
+}
+
+internal inline fun internalInlineFun() {
+    val a by A()
+    val b by B()
+    val c by C()
+    val d by D()
+    val e by E()
+    val f by 1
+    val g by true
+    val h by 1.0
+    val i by 'a'
+    var j by ""
+    val k by ""
+}
+
+inline fun publicInlineFun() {
+    val a by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>A<!>()
+    val b by B()
+    val c by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>C<!>()
+    val d by D()
+    val e by E()
+    val f by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>1<!>
+    val g by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>true<!>
+    val h by 1.0
+    val i by 'a'
+    var j by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>""<!>
+    val k by ""
+}
+
+@PublishedApi
+internal inline fun publishedApiInlineFun() {
+    val a by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>A<!>()
+    val b by B()
+    val c by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>C<!>()
+    val d by D()
+    val e by E()
+    val f by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>1<!>
+    val g by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>true<!>
+    val h by 1.0
+    val i by 'a'
+    var j by <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>""<!>
+    val k by ""
+}
+
diff --git a/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt b/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt
new file mode 100644
index 0000000..4631d9a
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt
@@ -0,0 +1,95 @@
+// !DIAGNOSTICS: -NOTHING_TO_INLINE
+// LANGUAGE: -ForbidLocalDelegatedPropertiesWithPrivateAccessorsInPublicInlineFunctions
+
+import kotlin.reflect.KProperty
+
+@PublishedApi
+internal class A {
+    internal operator fun getValue(nothing: Any?, property: KProperty<*>): String = ""
+}
+
+@PublishedApi
+internal class B {
+    operator fun getValue(nothing: Any?, property: KProperty<*>): String = ""
+}
+
+class C {
+    internal operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+class D {
+    @PublishedApi
+    internal operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+class E {
+    operator fun getValue(nothing: Nothing?, property: KProperty<*>): String = ""
+}
+
+private operator fun Int.getValue(nothing: Any?, property: KProperty<*>) = ""
+internal operator fun Boolean.getValue(nothing: Any?, property: KProperty<*>) = ""
+operator fun Double.getValue(nothing: Any?, property: KProperty<*>) = ""
+
+@PublishedApi
+internal operator fun Char.getValue(nothing: Any?, property: KProperty<*>) = ""
+
+private operator fun String.setValue(nothing: Any?, property: KProperty<*>, any: Any) = "OK"
+operator fun String.getValue(nothing: Any?, property: KProperty<*>) = "OK"
+
+private inline fun privateInlineFun() {
+    val a by A()
+    val b by B()
+    val c by C()
+    val d by D()
+    val e by E()
+    val f by 1
+    val g by true
+    val h by 1.0
+    val i by 'a'
+    var j by ""
+    val k by ""
+}
+
+internal inline fun internalInlineFun() {
+    val a by A()
+    val b by B()
+    val c by C()
+    val d by D()
+    val e by E()
+    val f by 1
+    val g by true
+    val h by 1.0
+    val i by 'a'
+    var j by ""
+    val k by ""
+}
+
+inline fun publicInlineFun() {
+    val a by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>A<!>()
+    val b by B()
+    val c by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>C<!>()
+    val d by D()
+    val e by E()
+    val f by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>1<!>
+    val g by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>true<!>
+    val h by 1.0
+    val i by 'a'
+    var j by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>""<!>
+    val k by ""
+}
+
+@PublishedApi
+internal inline fun publishedApiInlineFun() {
+    val a by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>A<!>()
+    val b by B()
+    val c by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>C<!>()
+    val d by D()
+    val e by E()
+    val f by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>1<!>
+    val g by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>true<!>
+    val h by 1.0
+    val i by 'a'
+    var j by <!DEPRECATED_IMPLICIT_NON_PUBLIC_API_ACCESS!>""<!>
+    val k by ""
+}
+
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java
index 56d2dcc..4b0daf3 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java
@@ -18631,6 +18631,18 @@
             }
 
             @Test
+            @TestMetadata("localDelegatedPropertiesInInlineError.kt")
+            public void testLocalDelegatedPropertiesInInlineError() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineError.kt");
+            }
+
+            @Test
+            @TestMetadata("localDelegatedPropertiesInInlineWarning.kt")
+            public void testLocalDelegatedPropertiesInInlineWarning() throws Exception {
+                runTest("compiler/testData/diagnostics/tests/inline/localDelegatedPropertiesInInlineWarning.kt");
+            }
+
+            @Test
             @TestMetadata("localFun.kt")
             public void testLocalFun() throws Exception {
                 runTest("compiler/testData/diagnostics/tests/inline/localFun.kt");
diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt
index f82e1b2..cfa886d 100644
--- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt
+++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt
@@ -299,6 +299,8 @@
     ReferencesToSyntheticJavaProperties(KOTLIN_2_1), // KT-8575
     ProhibitImplementingVarByInheritedVal(KOTLIN_2_1, kind = BUG_FIX), // KT-56779
     PrioritizedEnumEntries(KOTLIN_2_1, kind = UNSTABLE_FEATURE), // KT-xxxxx
+    ForbidLocalDelegatedPropertiesWithPrivateAccessorsInPublicInlineFunctions(KOTLIN_2_1, kind = BUG_FIX),
+
 
     // End of 2.* language features --------------------------------------------------