diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java index 44da666b2c9..e84a64739bf 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java @@ -2116,6 +2116,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41308.kt"); } + @TestMetadata("kt41396.kt") + public void testKt41396() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.kt"); + } + @TestMetadata("nestedLambdaInferenceWithListMap.kt") public void testNestedLambdaInferenceWithListMap() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt"); diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.kt new file mode 100644 index 00000000000..bb8733bbb11 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.kt @@ -0,0 +1,22 @@ +// FIR_IDENTICAL +// !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS + +fun Flow.transformLatest(@BuilderInference transform: suspend FlowCollector.(value: T) -> Unit) = null as Flow + +interface Flow { + suspend fun collect(collector: FlowCollector) +} + +interface FlowCollector { + suspend fun emit(value: T) +} + +fun flow(@BuilderInference block: suspend FlowCollector.() -> Unit) = null as Flow +fun flowOf(value: T) = null as Flow + +fun foo() = flow { + flowOf(false).transformLatest { + emit(false) + } + emit(0) +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.txt new file mode 100644 index 00000000000..51c52fb4b71 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.txt @@ -0,0 +1,20 @@ +package + +public fun flow(/*0*/ @kotlin.BuilderInference block: suspend FlowCollector.() -> kotlin.Unit): Flow +public fun flowOf(/*0*/ value: T): Flow +public fun foo(): Flow +public fun Flow.transformLatest(/*0*/ @kotlin.BuilderInference transform: suspend FlowCollector.(value: T) -> kotlin.Unit): Flow + +public interface Flow { + public abstract suspend fun collect(/*0*/ collector: FlowCollector): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface FlowCollector { + public abstract suspend fun emit(/*0*/ value: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 2f160c30cf8..04ba656c289 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -2156,6 +2156,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41308.kt"); } + @TestMetadata("kt41396.kt") + public void testKt41396() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.kt"); + } + @TestMetadata("nestedLambdaInferenceWithListMap.kt") public void testNestedLambdaInferenceWithListMap() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index d94fd6f5e28..d01da12d875 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -2156,6 +2156,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41308.kt"); } + @TestMetadata("kt41396.kt") + public void testKt41396() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt41396.kt"); + } + @TestMetadata("nestedLambdaInferenceWithListMap.kt") public void testNestedLambdaInferenceWithListMap() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt");