I’m wondering why it is work.
I didn’t provide when branch for ‘Unknown’ class and expect compile error but there no error at all. Compiled and running.
What is missing? Looks like I don’t understand how it should work but documentation said:
The key benefit of using sealed classes comes into play when you use them in a when
expression. If it’s possible to verify that the statement covers all cases, you don’t need to add an else
clause to the statement.