Files
kotlin-fork/compiler/testData/diagnostics/tests/resolve/invoke/wrongInvokeExtension.fir.kt
T
Pavel Kirpichenkov c5893913f3 [NI] Remove lambda coersion to Unit in case of error return type(s)
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
2020-01-23 13:18:50 +03:00

21 lines
233 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 x: Int = b.a()
b.(a)()
with(b) {
val y: Int = a()
(a)()
}
}