The argument types of an anonymous function must be fully known. (SLS 8.5)
{ case X(x) => … } is a partial function, but the compiler still doesn’t know what your input type is, except that it’s a supertype of X. Normally this isn’t a problem because if you’re writing an anonymous function, the type is known from the context. But here is how you can provide the … Read more