FIR DFA: take all statements from ?. if result is non-null.
I.e. a?.f(b as T) != null => b is T. This also allows to remove the copyAllInformationFrom hack by moving the edge directly in the control flow graph.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// !DUMP_CFG
|
||||
interface A {
|
||||
fun foo(): A
|
||||
fun bar(): A
|
||||
fun bar(x: String): A
|
||||
}
|
||||
|
||||
interface B {
|
||||
@@ -10,9 +10,15 @@ interface B {
|
||||
}
|
||||
|
||||
fun test_1(x: A?) {
|
||||
x?.foo()?.bar()
|
||||
x?.foo()?.bar("")
|
||||
}
|
||||
|
||||
fun test_2(x: B?) {
|
||||
x?.foo?.bar
|
||||
}
|
||||
|
||||
fun test_3(x: A?, y: String?) {
|
||||
if (x?.bar(y as String) != null) {
|
||||
y.length
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user