105358dcf6
Let's call builder lambdas (BL) a lambda that has non-fixed input type projection at the moment of lambda arguments analysis, such lambdas is a subject to be analyzed with builder inference Due to bug in constraint system joining algorithm, currently system of two or more such lambdas may lead to unsound type inference Diagnostic added here should be reported in case when there are two BL that shares a common constraint system, while not annotated with @BuilderInference, as a protection against aforementioned bug It's reported by ConstraintSystemCompleter when such situation has occurred during builder inference phase, it is the same place that decides wherever lambdas is subject to builder inference or not KT-53740
20 lines
634 B
Kotlin
Vendored
20 lines
634 B
Kotlin
Vendored
// WITH_STDLIB
|
|
// SKIP_TXT
|
|
fun <From, To> InputWrapper<From>.doMapping(
|
|
foo: (From) -> List<To>,
|
|
bar: (List<To>) -> Boolean = { it.isNotEmpty() },
|
|
) = InputWrapper(value = foo(value))
|
|
|
|
data class InputWrapper<TItem>(val value: TItem)
|
|
|
|
data class Output(val source: InputWrapper<List<String>>)
|
|
|
|
fun main2(input: InputWrapper<Unit>): Output {
|
|
val output = input.<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>doMapping<!>(
|
|
foo = { buildList { add("this is List<String>") } },
|
|
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>bar = { it.isNotEmpty() }<!>,
|
|
)
|
|
|
|
return Output(source = <!TYPE_MISMATCH!>output<!>)
|
|
}
|