In Scala 3, ValueEnum entries can't have type parameters. More specifically, if an instance of a ValueEnum entry extends a type with type parameters, findValues will emit an error similar to the following one.
Fails to check value entry ExampleEnum.Entry1 for enum ExampleEnumEntry[_ >: scala.Nothing <: scala.Any]
See the following example.
import enumeratum.values.{StringEnum, StringEnumEntry}
sealed abstract class ExampleEnumEntry[Suffix](override val value: String) extends StringEnumEntry {
def toString(suffix: Suffix): String = value + suffix.toString
}
object ExampleEnum extends StringEnum[ExampleEnumEntry[?]] {
case object Entry1 extends ExampleEnumEntry[Int]("Entry1")
case object Entry2 extends ExampleEnumEntry[String]("Entry2")
override def values: IndexedSeq[ExampleEnumEntry[?]] = findValues
}
In Scala 3,
ValueEnum
entries can't have type parameters. More specifically, if an instance of a ValueEnum entry extends a type with type parameters,findValues
will emit an error similar to the following one.See the following example.
https://scastie.scala-lang.org/YLsHXSb3RrGwsoA9IXJIkA