[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
|
||||
|
||||
class B
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
class B
|
||||
|
||||
class A {
|
||||
@@ -11,7 +13,7 @@ fun test(a: A, b: B) {
|
||||
|
||||
b.<!FUNCTION_EXPECTED!>(a)<!>()
|
||||
|
||||
with(b) {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(b) {
|
||||
val <!UNUSED_VARIABLE!>y<!>: Int = a()
|
||||
<!FUNCTION_EXPECTED!>(a)<!>()
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ fun testTwoLambdas() {
|
||||
<!OI;TYPE_MISMATCH!>twoLambdaArgs({})
|
||||
{}
|
||||
<!MANY_LAMBDA_EXPRESSION_ARGUMENTS, UNEXPECTED_TRAILING_LAMBDA_ON_A_NEW_LINE!>{}<!><!>
|
||||
} else {
|
||||
} else <!NI;TYPE_MISMATCH!>{
|
||||
{}
|
||||
}<!>
|
||||
}<!><!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user