KT-5200 Mark unreachable code in lambdas
#KT-5200 Fixed
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
//KT-5200 Mark unreachable code in lambdas
|
||||
|
||||
fun test1(): String {
|
||||
doCall @local {
|
||||
() : String ->
|
||||
throw NullPointerException()
|
||||
<!UNREACHABLE_CODE!>"b3"<!> //unmarked
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun test2(nonLocal: String, b: Boolean): String {
|
||||
doCall @local {
|
||||
() : String ->
|
||||
if (b) {
|
||||
return@local "b1"
|
||||
} else {
|
||||
return@local "b2"
|
||||
}
|
||||
<!UNREACHABLE_CODE!>"b3"<!> //unmarked
|
||||
}
|
||||
|
||||
return nonLocal
|
||||
}
|
||||
|
||||
inline fun doCall(block: ()-> String) = block()
|
||||
@@ -37,7 +37,7 @@ fun t3() : String {
|
||||
else {
|
||||
<!RETURN_NOT_ALLOWED!>return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!><!>
|
||||
}
|
||||
<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@l 0<!>
|
||||
<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED, UNREACHABLE_CODE!>return@l 0<!>
|
||||
}
|
||||
)
|
||||
invoker(
|
||||
|
||||
Reference in New Issue
Block a user