Suppose we have a trait with 3 subcase classes. when we match this trait with two of them and forgot to check the third one, probably, we do not notice it during compile-time and then we get a runtime error especially in the case of using this pattern match in a mutually recursive function.
Is there any Language construct (kind of specific pattern match perhaps) that can assure all subclasses are handled? If so what about more sophisticated pattern matches? (more complex than just matching subclasses of a trait) Is there any mechanism that can make us assure those pattern matches are total function?