[NI] Remove Nothing result type restriction in most cases
Make Nothing as result type not suitable only for if, when, try and ?: special functions.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// See KT-10913 Bogus unreachable code warning
|
||||
|
||||
fun fn() : String? = null
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// See KT-10913 Bogus unreachable code warning
|
||||
|
||||
fun fn() : String? = null
|
||||
@@ -8,6 +7,6 @@ fun foo(): String {
|
||||
}
|
||||
fun bar(): String {
|
||||
val x = fn() ?: return ""
|
||||
<!UNREACHABLE_CODE!>val <!UNUSED_VARIABLE!>y<!> =<!> x<!UNNECESSARY_SAFE_CALL!>?.<!>let { throw Exception() } <!NI;UNREACHABLE_CODE, NI;USELESS_ELVIS, OI;UNREACHABLE_CODE, OI;USELESS_ELVIS!>?: "unreachable"<!>
|
||||
<!UNREACHABLE_CODE!>val <!UNUSED_VARIABLE!>y<!> =<!> x<!UNNECESSARY_SAFE_CALL!>?.<!>let { throw Exception() } <!UNREACHABLE_CODE, USELESS_ELVIS!>?: "unreachable"<!>
|
||||
<!UNREACHABLE_CODE!>return y<!>
|
||||
}
|
||||
Reference in New Issue
Block a user