[FIR] Fix data-flow after while loops
This commit is contained in:
committed by
Mikhail Glukhikh
parent
91b432b4a1
commit
645602b675
@@ -1,5 +1,5 @@
|
||||
fun foo(s: String?): Int {
|
||||
do {
|
||||
} while (s==null)
|
||||
return s.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
return s.length
|
||||
}
|
||||
@@ -7,7 +7,7 @@ public fun foo(p: String?, r: String?): Int {
|
||||
} while (r == null)
|
||||
} while (!x())
|
||||
// Auto cast possible
|
||||
r.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
r.length
|
||||
// Auto cast possible
|
||||
return p.length
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ public fun foo(p: String?, r: String?): Int {
|
||||
} while (r == null)
|
||||
} while (!x())
|
||||
// Auto cast NOT possible due to long continue
|
||||
r.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
r.length
|
||||
// Auto cast possible
|
||||
return p.length
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public fun foo(p: String?, r: String?, q: String?): Int {
|
||||
if (!x()) break
|
||||
}
|
||||
// Smart cast is possible everywhere
|
||||
r.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
r.length
|
||||
q.length
|
||||
return p.length
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ public fun foo(p: String?, r: String?, q: String?): Int {
|
||||
if (!x()) break
|
||||
}
|
||||
// Smart cast is possible everywhere
|
||||
r.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
r.length
|
||||
q.length
|
||||
return p.length
|
||||
}
|
||||
+1
-1
@@ -12,7 +12,7 @@ public fun foo(p: String?, r: String?, q: String?): Int {
|
||||
if (!x()) break
|
||||
}
|
||||
// Smart cast is possible everywhere
|
||||
r.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
r.length
|
||||
q.length
|
||||
return p.length
|
||||
}
|
||||
+1
-1
@@ -14,6 +14,6 @@ public fun foo(p: String?, r: String?, q: String?): Int {
|
||||
// Smart cast is possible only for q
|
||||
q.length
|
||||
// But not possible for the others
|
||||
r.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
r.length
|
||||
return p.length
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fun foo(s: String?): Int {
|
||||
while (s==null) {
|
||||
}
|
||||
return s.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
return s.length
|
||||
}
|
||||
+1
-1
@@ -5,5 +5,5 @@ fun main() {
|
||||
if (i == 10) result = "non null"
|
||||
else i++
|
||||
}
|
||||
result.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
result.length
|
||||
}
|
||||
Reference in New Issue
Block a user