[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:
Vendored
+2
-2
@@ -6,12 +6,12 @@ class A<T> {
|
||||
class Out<out E>
|
||||
|
||||
fun test(x: A<out CharSequence>, y: Out<CharSequence>) {
|
||||
with(x) {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(x) {
|
||||
// TODO: this diagnostic could be replaced with TYPE_MISMATCH_DUE_TO_TYPE_PROJECTION
|
||||
"".<!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>()
|
||||
<!OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>y<!>.<!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>bar<!>()
|
||||
|
||||
with(y) {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(y) {
|
||||
<!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER, OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>bar<!>()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user