Sergio Pro
12/13/2018, 7:30 AMfun <T : Entity> write(entity: T) {
when (entity) {
is One -> doSomething(entity)
is Two -> {}
// etc
}
}
But when I'm trying to do is One, is Two -> doSomething(entity)
I basically loose the smart cast and get Type mismatch: expected XXX found T
compile error. Is there a way to smart cast multiple types on a single line or do I need to keep each on a separate branch of when
?