I do not think that you, unfortunately, can. TestEnum.One is really just an instance of the Enumeration#Value class. Actually, it is much worse than just this - your enum values ββare erased in the same way:
object Weekday extends Enumeration { val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value } def foo(w: Weekday.Value) def foo(e: TestEnum.Value) //won't compile as they erase to same type
Because the instances of your enum are just instances of Enumeration#Value , their declaration class is simply scala.Enumeration .
This is frustrating, but it seems that these scala listings are worse than worthless; if you pass them through serialization (at least in 2.7.7), you will also not be able to do equality checks!
source share