how come this compiles without an exhaustive `when...
# getting-started
d
how come this compiles without an exhaustive
when
?
Copy code
sealed class User {
    object Guest: User()
    class LoggedIn(val uname: String): User()
}

fun test (user: User) {
    when (user) {
        is User.Guest ->
            println("Was a guest")
    }
}

fun main(args: Array<String>) {
    test(User.Guest) // prints "Was a guest"
}