Int i= ("Int") object
# announcements
v
Int i= ("Int") object
m
So you get a string containing a type-name, and you want to cast an object to that type?
If so, you would have to do something like this (unless you use reflection):
Copy code
when(typeName) {
    "Int" -> object as Int
    "String" -> object as String
    // List all types you want to cast to.
    else -> object
}
n
i do not see the point there.. afaik
as Type
does not change anything in the object so at some point it would get bunched together again as
Any
and nothing is gained unless you want to have your ClassCastException thrown exactly there