Why it cannot be gauranteed? How is it different from typechecking the actual SomeSealedClass?
I certainly can do something like this, but I want compiler to make sure I wont miss anything when I’ll add new SomeSealedClassNewSubClass. Also I want it to generate me the branches
There is a huge difference between SomeSealedClass and KClass<SomeSealedClass. They are not similar at all from the compiler’s point of view. For example, SomeSealedClass is an actual sealed class, while KClass<SomeSealedClass> definitely is not.
when can only determine whether its branches are exhaustive for sealed classes, so if you use it on KClass<...>, the compiler cannot help you.
Of course, the compiler can be extended to understand that KClass<SomeSealedClass> means that only the KClass of one of the subclasses of SomeSealedClass will be possible there. But for everything there is a cost: complexity, development time, etc. I am not sure if it will be worth the effort for this edge case.
What is it you are trying to do? Maybe there is another way.