Supported initialization with assignment instead of declaration

This commit is contained in:
Valentin Kipyatkov
2016-04-06 14:59:26 +03:00
parent 1fe84b8a25
commit ac46684592
3 changed files with 30 additions and 4 deletions
@@ -0,0 +1,12 @@
// WITH_RUNTIME
fun foo(list: List<String>) {
var result: String? = ""
result = null
<caret>for (s in list) {
if (s.length > 0) {
result = s
break
}
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo(list: List<String>) {
var result: String? = ""
<caret>result = list.firstOrNull { it.length > 0 }
}