[FIR] Track local variable assigned types for smartcast stability

When a lambda captures a local variable without a contract, future
assignments can impact the smartcast stability for that variable within
the lambda. Because future assignments can appear in both resolved and
unresolved code, track each assignment as encountered. To determine if
a smartcast can be considered stable, check that all future assignments
are resolved and do not revert variable to a super type.

^KT-58191 Fixed
This commit is contained in:
Brian Norman
2024-01-04 15:21:12 -06:00
committed by Space Team
parent e02c28c88a
commit e3ddeff230
8 changed files with 185 additions and 58 deletions
@@ -55,7 +55,7 @@ fun test4() {
require(x is String)
runWithoutContract {
x = ""
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
x.length
}
}