FIR CFG: check lambda concurrency by data flow, not control flow
var p: String? = something
if (p != null) {
foo(
run { p = null; n() },
// This lambda executes strictly after the one above by CFG,
// but data flow for type inference comes from before the call
// so p would get smartcasted if not forbidden.
run { p.length; 123 }
)
}
This commit is contained in:
@@ -71,7 +71,7 @@ fun test7(x: String?) {
|
||||
foo(
|
||||
id(run { p = null; n() }),
|
||||
1,
|
||||
run { p.length; 123 } // Bad (p = null)
|
||||
run { <!SMARTCAST_IMPOSSIBLE!>p<!>.length; 123 } // Bad (p = null)
|
||||
)
|
||||
p<!UNSAFE_CALL!>.<!>length // Bad (p = null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user