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 7c6b36fe522..594241dbafd 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 @@ -36936,6 +36936,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true); } + @Test + @TestMetadata("buildListToUpperBound.kt") + public void testBuildListToUpperBound() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt"); + } + + @Test + @TestMetadata("buildListToUpperBoundForbidden.kt") + public void testBuildListToUpperBoundForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt"); + } + @Test @TestMetadata("completeIrrelevantCalls.kt") public void testCompleteIrrelevantCalls() throws Exception { @@ -36966,12 +36978,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt48445.kt"); } - @Test - @TestMetadata("kt50520.kt") - public void testKt50520() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt"); - } - @Test @TestMetadata("resolveUsualCallWithBuilderInference.kt") public void testResolveUsualCallWithBuilderInference() throws Exception { 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 068f4f3d38e..ac691d3c85e 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 @@ -36936,6 +36936,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true); } + @Test + @TestMetadata("buildListToUpperBound.kt") + public void testBuildListToUpperBound() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt"); + } + + @Test + @TestMetadata("buildListToUpperBoundForbidden.kt") + public void testBuildListToUpperBoundForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt"); + } + @Test @TestMetadata("completeIrrelevantCalls.kt") public void testCompleteIrrelevantCalls() throws Exception { @@ -36966,12 +36978,6 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt48445.kt"); } - @Test - @TestMetadata("kt50520.kt") - public void testKt50520() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt"); - } - @Test @TestMetadata("resolveUsualCallWithBuilderInference.kt") public void testResolveUsualCallWithBuilderInference() throws Exception { 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 7df67be31c2..482ee574d47 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 @@ -37032,6 +37032,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true); } + @Test + @TestMetadata("buildListToUpperBound.kt") + public void testBuildListToUpperBound() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt"); + } + + @Test + @TestMetadata("buildListToUpperBoundForbidden.kt") + public void testBuildListToUpperBoundForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt"); + } + @Test @TestMetadata("completeIrrelevantCalls.kt") public void testCompleteIrrelevantCalls() throws Exception { @@ -37062,12 +37074,6 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt48445.kt"); } - @Test - @TestMetadata("kt50520.kt") - public void testKt50520() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt"); - } - @Test @TestMetadata("resolveUsualCallWithBuilderInference.kt") public void testResolveUsualCallWithBuilderInference() throws Exception { diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.fir.kt similarity index 65% rename from compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.fir.kt rename to compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.fir.kt index caecd7bc5a2..d41665a4dbf 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.fir.kt @@ -1,5 +1,6 @@ // WITH_STDLIB -// SKIP_TXT +// !LANGUAGE: -ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound +// ISSUE: KT-50520 fun box(): String { buildList { diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt new file mode 100644 index 00000000000..909030f40d5 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt @@ -0,0 +1,11 @@ +// WITH_STDLIB +// !LANGUAGE: -ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound +// ISSUE: KT-50520 + +fun box(): String { + buildList { + val foo = { first() } + add(0, foo) + } + return "OK" +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt new file mode 100644 index 00000000000..940e3b75847 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt @@ -0,0 +1,11 @@ +// WITH_STDLIB +// !LANGUAGE: +ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound +// ISSUE: KT-56169 + +fun box(): String { + buildList { + val foo = { first() } + add(0, foo) + } + return "OK" +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt similarity index 69% rename from compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt rename to compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt index ad138c6b4c1..9c7eec512a8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt @@ -1,5 +1,6 @@ // WITH_STDLIB -// SKIP_TXT +// !LANGUAGE: +ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound +// ISSUE: KT-56169 fun box(): String { buildList { 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 f4da82fb65b..e9ac1337f4d 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 @@ -37032,6 +37032,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true); } + @Test + @TestMetadata("buildListToUpperBound.kt") + public void testBuildListToUpperBound() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.kt"); + } + + @Test + @TestMetadata("buildListToUpperBoundForbidden.kt") + public void testBuildListToUpperBoundForbidden() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.kt"); + } + @Test @TestMetadata("completeIrrelevantCalls.kt") public void testCompleteIrrelevantCalls() throws Exception { @@ -37062,12 +37074,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt48445.kt"); } - @Test - @TestMetadata("kt50520.kt") - public void testKt50520() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/kt50520.kt"); - } - @Test @TestMetadata("resolveUsualCallWithBuilderInference.kt") public void testResolveUsualCallWithBuilderInference() throws Exception {