Check that "break" and "continue" do not produce false errors when using analyzeInContext

This commit is contained in:
Valentin Kipyatkov
2016-04-19 20:14:14 +03:00
parent 49f2c5f657
commit bbb6ef4fbc
2 changed files with 43 additions and 0 deletions
@@ -0,0 +1,24 @@
// WITH_RUNTIME
import java.util.ArrayList
fun foo(): List<String> {
while (true) {
val result = ArrayList<String>()
<caret>for (s in list()) {
if (s.length > 0) {
result.add(s)
}
}
if (bar1()) continue
if (bar2()) break
return result
}
return emptyList()
}
fun list() = listOf("a")
fun bar1() = true
fun bar2() = true
@@ -0,0 +1,19 @@
// WITH_RUNTIME
import java.util.ArrayList
fun foo(): List<String> {
while (true) {
<caret>val result = list().filter { it.length > 0 }
if (bar1()) continue
if (bar2()) break
return result
}
return emptyList()
}
fun list() = listOf("a")
fun bar1() = true
fun bar2() = true