FIR DFA: add more called-in-place tests
This commit is contained in:
+16
@@ -71,3 +71,19 @@ fun test5(x: Any?, q: String?) {
|
||||
p<!UNSAFE_CALL!>.<!>length // Bad: p is String? | (String? & Int) = String?
|
||||
p?.length // OK: p is String?
|
||||
}
|
||||
|
||||
fun test6() {
|
||||
val x: String
|
||||
// not necessarily initialized in second lambda (may call in any order)
|
||||
run2({ x = ""; x.length }, { x.length })
|
||||
x.length // initialized here
|
||||
}
|
||||
|
||||
fun test7() {
|
||||
val x: Any? = ""
|
||||
val y: Any?
|
||||
run2({ y = x }, { })
|
||||
if (y is String) {
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!> // ok - aliased
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user