[FIR] Copy implications from previous data flows when there is only one

Postponed lambdas introduce a host of challenges in data-flow analysis.
While inheriting type statements was disabled while these challenges are
being considered, we must still copy type statements from non-postponed
lambda edges. It seems the same is true for implications.

Implications are copied from previous flows when there is only a single
previous flow. That is because it never seemed to be required based on
test results. However, a recent test case revealed that copying is
required when there are multiple previous flows, but only one flow is
from a non-postponed-lambda node.

Combining implications from multiple non-postponed-lambda nodes did not
have an impact on test results, so until such a test case can be
created, the overhead of calculating common implications from multiple
flows will be avoided.

^KT-63351 Fixed
This commit is contained in:
Brian Norman
2024-01-25 07:36:31 -06:00
committed by Space Team
parent 478205e6e8
commit a2c9e5b36a
5 changed files with 41 additions and 15 deletions
@@ -1,6 +1,14 @@
fun calc(x: List<String>?) {
// WITH_STDLIB
// ISSUE: KT-63351
fun test1(x: List<String>?) {
// x should be non-null in arguments list, despite of a chain
x?.subList(0, x.size)?.
subList(0, x.size)?.
get(x.size)
}
fun test2(x: List<String>?) {
x?.filter { true }!!.size
x.size
}
@@ -1,6 +1,14 @@
fun calc(x: List<String>?) {
// WITH_STDLIB
// ISSUE: KT-63351
fun test1(x: List<String>?) {
// x should be non-null in arguments list, despite of a chain
x?.subList(0, <!DEBUG_INFO_SMARTCAST!>x<!>.size)?.
subList(0, <!DEBUG_INFO_SMARTCAST!>x<!>.size)?.
get(<!DEBUG_INFO_SMARTCAST!>x<!>.size)
}
fun test2(x: List<String>?) {
x?.filter { true }!!.size
<!DEBUG_INFO_SMARTCAST!>x<!>.size
}
@@ -1,3 +1,4 @@
package
public fun calc(/*0*/ x: kotlin.collections.List<kotlin.String>?): kotlin.Unit
public fun test1(/*0*/ x: kotlin.collections.List<kotlin.String>?): kotlin.Unit
public fun test2(/*0*/ x: kotlin.collections.List<kotlin.String>?): kotlin.Unit