diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java
index 20dd9d1e9f6..681fa38430e 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java
@@ -608,6 +608,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
runTest("compiler/fir/analysis-tests/testData/resolve/typeFromGetter.kt");
}
+ @Test
+ @TestMetadata("typeParameterInBoundsLocalFunction.kt")
+ public void testTypeParameterInBoundsLocalFunction() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt");
+ }
+
@Test
@TestMetadata("typeParameterInPropertyReceiver.kt")
public void testTypeParameterInPropertyReceiver() throws Exception {
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java
index 85ea98bf5f1..e8bc116e3f5 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java
@@ -514,6 +514,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/typeFromGetter.kt");
}
+ @TestMetadata("typeParameterInBoundsLocalFunction.kt")
+ public void testTypeParameterInBoundsLocalFunction() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt");
+ }
+
@TestMetadata("typeParameterInPropertyReceiver.kt")
public void testTypeParameterInPropertyReceiver() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/typeParameterInPropertyReceiver.kt");
diff --git a/compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.fir.txt b/compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.fir.txt
new file mode 100644
index 00000000000..ac95d8feb9e
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.fir.txt
@@ -0,0 +1,8 @@
+FILE: typeParameterInBoundsLocalFunction.kt
+ package test
+
+ public final fun f(): R|kotlin/Unit| {
+ local final fun f1(): R|kotlin/Unit| {
+ }
+
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt b/compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt
new file mode 100644
index 00000000000..801d7972844
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt
@@ -0,0 +1,4 @@
+package test
+fun f() {
+ fun f1() {}
+}
\ No newline at end of file
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java
index e6aaa5a0f65..663b7882872 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java
@@ -608,6 +608,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolve/typeFromGetter.kt");
}
+ @Test
+ @TestMetadata("typeParameterInBoundsLocalFunction.kt")
+ public void testTypeParameterInBoundsLocalFunction() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt");
+ }
+
@Test
@TestMetadata("typeParameterInPropertyReceiver.kt")
public void testTypeParameterInPropertyReceiver() throws Exception {
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java
index 2529fc6f2da..89a3898872f 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java
@@ -608,6 +608,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/typeFromGetter.kt");
}
+ @Test
+ @TestMetadata("typeParameterInBoundsLocalFunction.kt")
+ public void testTypeParameterInBoundsLocalFunction() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/typeParameterInBoundsLocalFunction.kt");
+ }
+
@Test
@TestMetadata("typeParameterInPropertyReceiver.kt")
public void testTypeParameterInPropertyReceiver() throws Exception {
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt
index c52454c2c41..67d9c0cb183 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt
@@ -611,10 +611,10 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
return simpleFunction
}
- doTransformTypeParameters(simpleFunction)
-
val containingDeclaration = context.containerIfAny
return context.withSimpleFunction(simpleFunction, session) {
+ doTransformTypeParameters(simpleFunction)
+
// TODO: I think it worth creating something like runAllPhasesForLocalFunction
if (containingDeclaration != null && containingDeclaration !is FirClass) {
// For class members everything should be already prepared
diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt
index 238defcb89d..009ce7477cf 100644
--- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt
+++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt
@@ -9,7 +9,7 @@ fun Bar.takeFoo(foo: Foo): Int = 1
class Inv
fun Inv>> main() {
- fun T> Bar.takeFoo(foo: Foo): String = ""
+ fun Bar.takeFoo(foo: Foo): String = ""
val foo = Foo()
Bar>>().takeFoo(foo)
diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.fir.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.fir.kt
deleted file mode 100644
index 5b978ffd14b..00000000000
--- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.fir.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-// !LANGUAGE: +ForbidInferringTypeVariablesIntoEmptyIntersection
-// WITH_STDLIB
-
-class Foo
-
-class Bar
-
-fun Bar.takeFoo(foo: Foo): Int = 1
-
-class Inv
-
-fun Inv>> main() {
- fun T> Bar.takeFoo(foo: Foo): String = ""
-
- val foo = Foo()
- Bar>>().takeFoo(foo)
-}
\ No newline at end of file
diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt
index cee3241561b..41f8f2a5522 100644
--- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt
+++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt
@@ -1,3 +1,4 @@
+// FIR_IDENTICAL
// !LANGUAGE: +ForbidInferringTypeVariablesIntoEmptyIntersection
// WITH_STDLIB
diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt
index f876caeb314..828e254a3fc 100644
--- a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt
+++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.fir.kt
@@ -1,4 +1,4 @@
fun bar() {
- fun T?> foo() {}
- foo()
+ fun <T: T?> foo() {}
+ foo()
}