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
21 lines
377 B
Kotlin
Vendored
21 lines
377 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
|
|
class B
|
|
|
|
class A {
|
|
operator fun B.invoke() {}
|
|
}
|
|
|
|
val B.a: () -> Int get() = { 5 }
|
|
|
|
fun test(a: A, b: B) {
|
|
val <!UNUSED_VARIABLE!>x<!>: Int = b.a()
|
|
|
|
b.<!FUNCTION_EXPECTED!>(a)<!>()
|
|
|
|
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(b) {
|
|
val <!UNUSED_VARIABLE!>y<!>: Int = a()
|
|
<!FUNCTION_EXPECTED!>(a)<!>()
|
|
}
|
|
}
|