More cases supported for "any"

This commit is contained in:
Valentin Kipyatkov
2016-04-06 12:00:35 +03:00
parent c0f3ab59ab
commit fba9b123dd
6 changed files with 74 additions and 26 deletions
@@ -0,0 +1,10 @@
// WITH_RUNTIME
fun foo(list: List<String>) {
var result = 0
<caret>for (s in list) {
if (s.length > 0) {
result = 1
break
}
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo(list: List<String>) {
<caret>val result = if (list.any { it.length > 0 }) 1 else 0
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo(list: List<String>) {
var result = takeInt()
<caret>for (s in list) {
if (s.length > 0) {
result = 1
break
}
}
}
fun takeInt(): Int = 0