[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
This commit is contained in:
+2
@@ -1,3 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {}
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {}
|
||||
@@ -8,7 +10,7 @@ fun <T: Closeable, R> T.foo(block: (T)-> R) = block
|
||||
fun <T: Closeable, R> T.foo(block: (T, T)-> R) = block
|
||||
|
||||
fun main() {
|
||||
C().foo { // no ambiguity here
|
||||
C().<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> { // no ambiguity here
|
||||
<!UNUSED_ANONYMOUS_PARAMETER!>www<!> ->
|
||||
<!UNRESOLVED_REFERENCE!>xs<!>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user