What does "Match case Unreachable Warning" exactly mean?

Suppose i have a match with some case statements and one of them is flagged as follows:

[warn] -- [E030] Match case Unreachable Warning: ...src/main/scala/ ... 
[warn]   |    case <pattern> => <statement>
[warn]   |         ^^^^^^^^^
[warn]   |         Unreachable case

I always interpreted this as that the statement would never be executed, independent of what is matched. But this is probably incorrect, given the fact that my issue report on a situation where the statement did get executed under this warning was closed under the motivation “is as expected”.

Thank you for any clous.

I would say that is correct. In the issue there is an additional warning that is not shown which is the root at the root of this strange behavior.

1 Like

Aha, thank you, i now understand why the compiler was led astray by the former warning. For errors such behaviour is not uncommon (and cannot be prohibited probably) but for warnings it is more rare.