Yes, looks like smart cast only works when it need...
# announcements
o
Yes, looks like smart cast only works when it needs to check conversion to String, but not when inferring. If you write it like this:
Copy code
val f = { it:Any?->
        when (it) {
            is String -> it
            else -> throw RuntimeException()
        }
    }
It infers
f
as
(Any?)->Any?