FIR DFA: revalidate reassigned variables after loops

If a certain type statement is true on loop entry and all continue
paths, then it is also true on exit if the condition did not reassign
the variable.

^KT-7676 tag fixed-in-k2
This commit is contained in:
pyos
2022-11-14 16:40:41 +01:00
committed by teamcity
parent f9745bd3f1
commit 02fedeb9ed
8 changed files with 83 additions and 59 deletions
@@ -19,7 +19,7 @@ interface MutableMultimap<K, V, C : Collection<V>> : Multimap<K, V, C> {
}
fun remove(key: K, value: V)
fun removeKey(key: K)
fun removeKey(key: K): C
fun clear()
}
@@ -64,8 +64,9 @@ abstract class BaseMultimap<K, V, C : Collection<V>, MC : MutableCollection<V>>
}
}
override fun removeKey(key: K) {
map.remove(key)
override fun removeKey(key: K): C {
@Suppress("UNCHECKED_CAST")
return map.remove(key) as C? ?: createEmptyContainer()
}
override fun clear() {