More relaxed checks for any() with return

This commit is contained in:
Valentin Kipyatkov
2016-04-06 12:42:20 +03:00
parent ff0bb4fbb8
commit 14ef93a797
4 changed files with 24 additions and 4 deletions
@@ -0,0 +1,11 @@
// WITH_RUNTIME
fun foo(list: List<String>): Int {
<caret>for (s in list) {
if (s.length > 0) {
return -1
}
}
return takeInt()
}
fun takeInt(): Int = 0
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo(list: List<String>): Int {
<caret>return if (list.any { it.length > 0 }) -1 else takeInt()
}
fun takeInt(): Int = 0