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:
+18
@@ -30,6 +30,24 @@ FILE: flowFromTwoInplaceLambdas.kt
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test1_tail(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
lvar p: R|kotlin/String?| = R|<local>/x|
|
||||
when () {
|
||||
!=(R|<local>/p|, Null(null)) -> {
|
||||
R|/run2|<R|kotlin/Int?|>(run2@fun <anonymous>(): R|kotlin/Int?| <inline=NoInline, kind=EXACTLY_ONCE> {
|
||||
R|<local>/p| = Null(null)
|
||||
^ R|/n|<R|kotlin/Int?|>()
|
||||
}
|
||||
, <L> = run2@fun <anonymous>(): R|kotlin/Int?| <inline=NoInline, kind=EXACTLY_ONCE> {
|
||||
R|<local>/p|.<Inapplicable(UNSTABLE_SMARTCAST): kotlin/String.length>#
|
||||
^ Int(123)
|
||||
}
|
||||
)
|
||||
R|<local>/p|.<Inapplicable(UNSAFE_CALL): kotlin/String.length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test2(x: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
lvar p: R|kotlin/Any?| = R|<local>/x|
|
||||
|
||||
Reference in New Issue
Block a user