Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt
T
Kirill Rakhman c3c2f6f90a [FIR] Don't set lambda parameter type to Nothing by default
... when the expected type is not a function type.
Instead set it to a new type variable.
This fixes a bunch of false negative CANNOT_INFER_PARAMETER_TYPE.

#KT-59882 Fixed
2024-02-26 08:59:22 +00:00

11 lines
268 B
Kotlin
Vendored

// FIR_IDENTICAL
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
package f
fun <R> h(f: (Boolean) -> R) = 1
fun <R> h(f: (String) -> R) = 2
fun test() = <!OVERLOAD_RESOLUTION_AMBIGUITY!>h<!>{ <!CANNOT_INFER_PARAMETER_TYPE!>i<!> -> getAnswer() }
fun getAnswer() = 42