Safe cast with return: fix false negative on lambda last statement #KT-27906 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-11-01 10:13:28 +09:00
committed by Mikhail Glukhikh
parent e49789f819
commit e8e51d1db4
7 changed files with 52 additions and 1 deletions
@@ -0,0 +1,7 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(x: Any) {
val s = run {
<caret>x as? String ?: return
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test(x: Any) {
run {
<caret>x as? String ?: return
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test(x: Any) {
run {
if (x !is String) return
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test(x: Any) {
run {
<caret>x as? String ?: return@run
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test(x: Any) {
run {
if (x !is String) return@run
}
}