I want to pattern match to the new enum type in Scala 3.
With Scala 2 this is easy, because there is an abstract class Enumeration
, that you can match on, like:
obj match {
case e: Enumeration => ...
case other => ...
}
How can I achieve this in Scala 3 as there is no common interface?
From the answers of this related question I tried:
case v: { def values: Array[?] } => ...
This compiles with a warning but when I run publishLocal
it throws an exception:
[error] (api / Compile / doc) java.lang.reflect.InvocationTargetException