FE: add test reproducing builder inference problem from KT-53422
This commit is contained in:
committed by
teamcity
parent
444cdaa2d8
commit
5cbecd276c
+6
@@ -14433,6 +14433,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt51464.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53422.kt")
|
||||
public void testKt53422() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("labaledCall.kt")
|
||||
public void testLabaledCall() throws Exception {
|
||||
|
||||
+6
@@ -14433,6 +14433,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt51464.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53422.kt")
|
||||
public void testKt53422() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("labaledCall.kt")
|
||||
public void testLabaledCall() throws Exception {
|
||||
|
||||
+6
@@ -14433,6 +14433,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt51464.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53422.kt")
|
||||
public void testKt53422() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("labaledCall.kt")
|
||||
public void testLabaledCall() throws Exception {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// SKIP_TXT
|
||||
fun test() {
|
||||
foo(
|
||||
flow { emit(0) }
|
||||
) { it.collect <!TOO_MANY_ARGUMENTS!>{}<!> }
|
||||
}
|
||||
|
||||
fun <F : Any> foo(
|
||||
bar: F,
|
||||
block: Scope<F>.(F) -> Unit
|
||||
) {}
|
||||
|
||||
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
|
||||
fun <W> flow(BuilderInference block: FlowCollector<W>.()->Unit): Flow<W> {
|
||||
val collector = FlowCollectorImpl<W>()
|
||||
collector.block()
|
||||
return object : Flow<W> {
|
||||
override fun collect(collector: FlowCollector<W>) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Scope<S>
|
||||
|
||||
interface Flow<out O> {
|
||||
fun collect(collector: FlowCollector<O>)
|
||||
}
|
||||
|
||||
fun interface FlowCollector<in I> {
|
||||
|
||||
fun emit(value: I)
|
||||
}
|
||||
|
||||
class FlowCollectorImpl<C> : FlowCollector<C> {
|
||||
override fun emit(value: C) {}
|
||||
}
|
||||
|
||||
fun Flow<*>.collect() {}
|
||||
Generated
+6
@@ -14439,6 +14439,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt51464.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53422.kt")
|
||||
public void testKt53422() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("labaledCall.kt")
|
||||
public void testLabaledCall() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user