Smart cast of `as` expression

Yes and in fact, this is a workaround I’m considering using. It is a little cryptic though. Unfortunately, “proper” solutions are pretty cumbersome:

val value2 = value as SealedType
when (value2) { ... }

Or:

if (value !is SealedType) {
    error("something")
}
when (value) { ... }