6df97dd199
^KT-41728 Fixed ^KT-46586 Fixed ^KT-49696 Fixed ^KT-51160 Fixed ^KT-53308 Fixed
22 lines
528 B
Kotlin
Vendored
22 lines
528 B
Kotlin
Vendored
// WITH_STDLIB
|
|
// ISSUE: KT-49696
|
|
|
|
interface Listener {
|
|
fun added(item: Any)
|
|
fun removed(item: Any)
|
|
}
|
|
|
|
val listeners = mutableListOf<Listener>()
|
|
|
|
fun smartCast(item: Any?) {
|
|
var current = item
|
|
if (current == null) {
|
|
current = Any()
|
|
listeners.forEach { it.added(<!SMARTCAST_IMPOSSIBLE!>current<!>) }
|
|
} else {
|
|
listeners.forEach { it.removed(<!SMARTCAST_IMPOSSIBLE!>current<!>) }
|
|
current = Any()
|
|
listeners.forEach { it.added(<!DEBUG_INFO_SMARTCAST!>current<!>) }
|
|
}
|
|
}
|