"Remove redundant 'if'" now works correctly with labeled return

So #KT-23109 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-03-06 03:45:40 +03:00
committed by Mikhail Glukhikh
parent 733cb42ced
commit 5d1f5d9bca
4 changed files with 42 additions and 10 deletions
+11
View File
@@ -0,0 +1,11 @@
// "Remove redundant 'if' statement" "true"
// WITH_RUNTIME
fun foo() {
listOf(1,2,3).find {
<caret>if (it > 0) {
return@find true
} else {
return@find false
}
}
}
@@ -0,0 +1,7 @@
// "Remove redundant 'if' statement" "true"
// WITH_RUNTIME
fun foo() {
listOf(1,2,3).find {
return@find it > 0
}
}