c5893913f3
Coersion to Unit from error type leads to misleading type mismatches: "expected <expected lambda return type> found Unit", despite no user-provided Unit / empty lambda. These diagnostics were collected, but not reported before, and that had been disguising the issue for a while. KT-34729 Fixed
10 lines
388 B
Kotlin
Vendored
10 lines
388 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
// Related issue: KT-28654
|
|
|
|
fun <K> select(): K = <!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>run <!NI;TYPE_MISMATCH!>{ <!OI;TYPE_MISMATCH!><!>}<!><!>
|
|
|
|
fun test() {
|
|
val x: Int = select()
|
|
val t = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>select<!>()
|
|
} |