Is there a way for Kotlin to smart cast `List<E...
# announcements
t
Is there a way for Kotlin to smart cast
List<E>
to
List<Foo>
(or
List<Bar>
) in the code below ?
a
Does it work if you inline it?
Copy code
inline fun <reified E : Any> update(updated: List<E>) = when(E::class) {
	Foo::class -> sendUpdate(aFoo, updated) // Error: expecting List<Foo>, found List<E>
	Bar::class -> sendUpdate(aBar, updated) // Error: expecting List<Bar>, found List<E>
	else -> error("Unknown type: ${E::class.simpleName}")
}
1