From dde4c46df78316e2c607940aa5182d7f4caaa206 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 21 Dec 2021 13:20:43 +0300 Subject: [PATCH] FIR: add original test from KT-49925 (passes) --- ...nosisCompilerFirTestdataTestGenerated.java | 6 ++++++ .../inference/problems/buildList.fir.txt | 19 +++++++++++++++++++ .../inference/problems/buildList.kt | 5 +++++ .../runners/FirDiagnosticTestGenerated.java | 6 ++++++ ...DiagnosticsWithLightTreeTestGenerated.java | 6 ++++++ 5 files changed, 42 insertions(+) create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt 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 3759b824b08..44d5be2e5fd 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 @@ -5136,6 +5136,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @Test + @TestMetadata("buildList.kt") + public void testBuildList() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt"); + } + @Test @TestMetadata("expectedType.kt") public void testExpectedType() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.fir.txt new file mode 100644 index 00000000000..9b20526d3a7 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.fir.txt @@ -0,0 +1,19 @@ +FILE: buildList.kt + public final class Wrapper : R|kotlin/Any| { + public constructor(tag: R|kotlin/String|): R|Wrapper| { + super() + } + + public final val tag: R|kotlin/String| = R|/tag| + public get(): R|kotlin/String| + + } + public final fun foo(wrappers: R|kotlin/collections/List|): R|kotlin/collections/List| { + ^foo R|kotlin/collections/buildList|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { + R|/wrappers|.R|kotlin/collections/mapTo||>(this@R|special/anonymous|, = mapTo@fun (it: R|Wrapper|): R|kotlin/String| { + ^ R|/it|.R|/Wrapper.tag| + } + ) + } + ) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt new file mode 100644 index 00000000000..18bc58544bb --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt @@ -0,0 +1,5 @@ +class Wrapper(val tag: String) + +fun foo(wrappers: List) = buildList { + wrappers.mapTo(this) { it.tag } +} 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 2a61f7df755..a32f917ad34 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 @@ -5136,6 +5136,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @Test + @TestMetadata("buildList.kt") + public void testBuildList() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt"); + } + @Test @TestMetadata("expectedType.kt") public void testExpectedType() 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 1be72b18033..29fc881cefc 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 @@ -5136,6 +5136,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true); } + @Test + @TestMetadata("buildList.kt") + public void testBuildList() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt"); + } + @Test @TestMetadata("expectedType.kt") public void testExpectedType() throws Exception {