When using sealed classes, the compiler only checks for subtypes in the same file.
One of the big selling points of sealed classes is the exhaustive checks when using a when
expression. So why isn't this implemented?
In 1 file I have:
class C : B()
In another file I have:
sealed class A
open class B : A()
fun switch(input: A) =
when(input) {
is B -> Unit
// is C -> Unit - I expect a compiler error since this is a subtype and it's commented out
}