Safe cast with return: fix false negative on lambda last statement #KT-27906 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
e49789f819
commit
e8e51d1db4
@@ -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
|
||||
}
|
||||
}
|
||||
+6
@@ -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
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(x: Any) {
|
||||
run {
|
||||
if (x !is String) return@run
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user