diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.fir.txt new file mode 100644 index 00000000000..e469b85bf08 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.fir.txt @@ -0,0 +1,33 @@ +FILE: KtFirCompositeScope.kt + public abstract interface KtScope : R|kotlin/Any| { + public abstract fun getAllNames(): R|kotlin/collections/Set| + + } + public final inline fun buildSet(@R|kotlin/BuilderInference|() builderAction: R|kotlin/collections/MutableSet.() -> kotlin/Unit|): R|kotlin/collections/Set| { + ^buildSet Null(null)!! + } + public final inline fun withValidityAssertion(action: R|() -> R|): R|R| { + ^withValidityAssertion R|/action|.R|SubstitutionOverride|() + } + public final class KtFirCompositeScope : R|kotlin/Any| { + public constructor(subScopes: R|kotlin/collections/List|): R|KtFirCompositeScope| { + super() + } + + public final val subScopes: R|kotlin/collections/List| = R|/subScopes| + public get(): R|kotlin/collections/List| + + public final fun getAllNames(): R|kotlin/collections/Set| { + ^getAllNames R|/withValidityAssertion||>( = withValidityAssertion@fun (): R|kotlin/collections/Set| { + ^ R|/buildSet|( = buildSet@fun R|kotlin/collections/MutableSet|.(): R|kotlin/Unit| { + this@R|/KtFirCompositeScope|.R|/KtFirCompositeScope.subScopes|.R|kotlin/collections/flatMapTo|)|>(this@R|special/anonymous|, = flatMapTo@fun (it: R|KtScope|): R|kotlin/collections/Iterable| { + ^ R|/it|.R|/KtScope.getAllNames|() + } + ) + } + ) + } + ) + } + + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.kt new file mode 100644 index 00000000000..12548ab432f --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.kt @@ -0,0 +1,19 @@ +interface KtScope { + fun getAllNames(): Set +} + +inline fun buildSet(@BuilderInference builderAction: MutableSet.() -> Unit): Set { + return null!! +} + +inline fun withValidityAssertion(action: () -> R): R { + return action() +} + +class KtFirCompositeScope(val subScopes: List) { + fun getAllNames(): Set = withValidityAssertion { + buildSet { + subScopes.flatMapTo(this) { it.getAllNames() } + } + } +} \ 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 b395e14d13d..48fd47a05da 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 @@ -5259,6 +5259,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt"); } + @Test + @TestMetadata("KtFirCompositeScope.kt") + public void testKtFirCompositeScope() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.kt"); + } + @Test @TestMetadata("lightMember.kt") public void testLightMember() 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 085d81a6e0a..4e8a00c2ae2 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 @@ -5336,6 +5336,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt"); } + @Test + @TestMetadata("KtFirCompositeScope.kt") + public void testKtFirCompositeScope() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KtFirCompositeScope.kt"); + } + @Test @TestMetadata("lightMember.kt") public void testLightMember() throws Exception {