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 eafb1b1d329..e1f957f159f 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 @@ -5288,6 +5288,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt"); } + @Test + @TestMetadata("buildListLazy.kt") + public void testBuildListLazy() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.kt"); + } + @Test @TestMetadata("buildSetWithVisitor.kt") public void testBuildSetWithVisitor() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.fir.txt new file mode 100644 index 00000000000..b24613a93c9 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.fir.txt @@ -0,0 +1,41 @@ +FILE: buildListLazy.kt + public final data class NameAndSafeValue : R|kotlin/Any| { + public constructor(name: R|kotlin/String|, value: R|kotlin/Int|): R|NameAndSafeValue| { + super() + } + + public final val name: R|kotlin/String| = R|/name| + public get(): R|kotlin/String| + + public final val value: R|kotlin/Int| = R|/value| + public get(): R|kotlin/Int| + + public final operator fun component1(): R|kotlin/String| + + public final operator fun component2(): R|kotlin/Int| + + public final fun copy(name: R|kotlin/String| = this@R|/NameAndSafeValue|.R|/NameAndSafeValue.name|, value: R|kotlin/Int| = this@R|/NameAndSafeValue|.R|/NameAndSafeValue.value|): R|NameAndSafeValue| + + } + public final fun getEnv(): R|kotlin/collections/List| { + ^getEnv R|kotlin/collections/listOf|() + } + private final val environment: R|kotlin/collections/List|by R|kotlin/lazy||>( = lazy@fun (): R|kotlin/collections/List| { + ^ R|kotlin/collections/buildList|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { + R|/getEnv|().R|kotlin/collections/forEach|( = forEach@fun (: R|NameAndSafeValue|): R|kotlin/Unit| { + lval name: R|kotlin/String| = R|/|.R|/NameAndSafeValue.component1|() + lval value: R|kotlin/Int| = R|/|.R|/NameAndSafeValue.component2|() + this@R|special/anonymous|.R|kotlin/collections/plusAssign|(R|/NameAndSafeValue.NameAndSafeValue|(R|/name|, R|/value|)) + } + ) + this@R|special/anonymous|.#( = sortBy@fun (it: R|NameAndSafeValue|): { + ^ R|/it|.# + } + ) + } + ) + } + ) + private get(): R|kotlin/collections/List| { + ^ D|/environment|.R|kotlin/getValue||>(Null(null), ::R|/environment|) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.kt new file mode 100644 index 00000000000..9913c674a08 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.kt @@ -0,0 +1,12 @@ +data class NameAndSafeValue(val name: String, val value: Int) + +fun getEnv() = listOf() + +private val environment: List by lazy { + buildList { + getEnv().forEach { (name, value) -> + this += NameAndSafeValue(name, value) + } + sortBy { it.name } + } +} 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 7bd7d21ea62..9ca356b10fa 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 @@ -5288,6 +5288,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt"); } + @Test + @TestMetadata("buildListLazy.kt") + public void testBuildListLazy() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.kt"); + } + @Test @TestMetadata("buildSetWithVisitor.kt") public void testBuildSetWithVisitor() 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 c589ca72009..d5bd6719bbf 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 @@ -5288,6 +5288,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildList.kt"); } + @Test + @TestMetadata("buildListLazy.kt") + public void testBuildListLazy() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/problems/buildListLazy.kt"); + } + @Test @TestMetadata("buildSetWithVisitor.kt") public void testBuildSetWithVisitor() throws Exception {