K2: Fix false-negative RETURN_TYPE_MISMATCH

^KT-53987 Fixed
^KT-55932 Fixed
This commit is contained in:
Denis.Zharkov
2022-11-29 12:54:13 +01:00
committed by Space Team
parent d7399ed1cf
commit 9fa0f51a61
28 changed files with 101 additions and 46 deletions
@@ -24,11 +24,11 @@ fun <T> bind2(r: Option<T>): Option<T> {
}
fun <T, R> bind3(r: Option<T>): Option<T> {
return if (r is Some) {
return <!RETURN_TYPE_MISMATCH!>if (r is Some) {
// Diagnoses an error correctly
if (true) None<R>() else r
}
else r
else r<!>
}
fun <T> bindWhen(r: Option<T>): Option<T> {
@@ -0,0 +1,4 @@
// SKIP_TXT
// ISSUE: KT-55932
fun test(x: String?): Int = <!RETURN_TYPE_MISMATCH!>x?.length ?: "smth"<!>
@@ -0,0 +1,4 @@
// SKIP_TXT
// ISSUE: KT-55932
fun test(x: String?): Int = <!TYPE_MISMATCH!>x?.length ?: "smth"<!>