~
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
index aef2dbc..019407e 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
@@ -14932,6 +14932,12 @@
}
@Test
+ @TestMetadata("differentCapturedTypes.kt")
+ public void testDifferentCapturedTypes() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt");
+ }
+
+ @Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java
index 8dfb3b7..5151c56 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java
@@ -14944,6 +14944,12 @@
}
@Test
+ @TestMetadata("differentCapturedTypes.kt")
+ public void testDifferentCapturedTypes() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt");
+ }
+
+ @Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java
index 22f3fa7..3408089 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java
@@ -14938,6 +14938,12 @@
}
@Test
+ @TestMetadata("differentCapturedTypes.kt")
+ public void testDifferentCapturedTypes() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt");
+ }
+
+ @Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt
new file mode 100644
index 0000000..958ed06
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt
@@ -0,0 +1,17 @@
+// FIR_IDENTICAL
+// SKIP_TXT
+
+fun <X> select(vararg x: X): X = x[0]
+fun <E> myE(): Out<E>? = null
+
+interface Out<out T>
+
+fun foo(w: Out<*>) {
+ // While it's controversial that we used Any? as a type argument here
+ // There's no much sense fixing it soon, as it's a rather reguler use case (when Out is List an myE() is something like emptyList())
+ //
+ // What matters here is that due to some implementation details that has no sense diving it, to make it work both instances
+ // of `w` expressions should be captured to a different captured types.
+ // That is why this tests has been attached to the commit.
+ select(w, myE() /* type argument is inferred to Any? */ ?: w)
+}
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 ff5fbe6..be48c39 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
@@ -14944,6 +14944,12 @@
}
@Test
+ @TestMetadata("differentCapturedTypes.kt")
+ public void testDifferentCapturedTypes() throws Exception {
+ runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/differentCapturedTypes.kt");
+ }
+
+ @Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");