[kotlin-dfa] Fix downTo and testdata

GitOrigin-RevId: b5913b63bac70853f647717e5c852b47b1b49757
This commit is contained in:
Tagir Valeev
2021-07-06 06:51:11 +00:00
committed by intellij-monorepo-bot
parent a1ba795a7d
commit 3ec8bacbca
4 changed files with 4 additions and 2 deletions
@@ -576,7 +576,7 @@ class KtControlFlowBuilder(val factory: DfaValueFactory, val context: KtExpressi
val (leftRelation, rightRelation) = when(ref) {
".." -> RelationType.GE to RelationType.LE
"until" -> RelationType.GE to RelationType.LT
"downTo" -> RelationType.LE to RelationType.GT
"downTo" -> RelationType.LE to RelationType.GE
else -> null to null
}
if (leftRelation != null && rightRelation != null) {
@@ -1,5 +1,6 @@
// PROBLEM: Condition is always false
// FIX: none
// WITH_RUNTIME
fun test() {
for(i in 1 until 10) {
if (<caret>i >= 10) {}
@@ -1,7 +1,7 @@
// PROBLEM: 'for' range is always empty
// FIX: none
fun test(x: Int, y: Int) {
if (y > x) return
if (y >= x) return
for(i in <caret>x..y) {
}
}
@@ -5,6 +5,7 @@ fun test(obj : Int) {
when (obj) {
in 0 until 10 -> {}
<caret>!in 0..9 -> {}
20 -> {}
else -> {}
}
}