You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@adriaanm said:
Scala's Enumeration is implemented purely as a library that the compiler has no knowledge of. I'm reluctant to special-case it in the pattern matcher.
Erik Allik (eallik) said (edited on Apr 5, 2014 3:00:24 AM UTC):
Would it be feasible to make Enumeration use case classes internally so as to benefit from the exhaustiveness checks performed on those?
@retronym said:
Closing as not-a-bug. There have been some efforts to make an alternative version of scala.Enumeration that would be amenable to pattern matching analysis, but we can't really do better with the legacy one.
I recommend using sealed heirarchies of case classes rather than scala.Enumeration. Plain old Java Enums are also a good choice (the pattern matcher can analyse these.)
This code produces the following warning in Test.foo:
Test.foo2 produces no warning (as expected), even though it's essentially the same match.
The text was updated successfully, but these errors were encountered: