@uncomment_to_crush Thank you for your question. As it stands currently, enums can not be extended by other classes/traits/enums. If I have understood correctly, you could require cases to be defined by declaring AnyFSM
as a trait, and another trait AnyFSMCompanion
to hold the cases:
trait AnyFSM { enumCase: scala.reflect.Enum => }
trait AnyFSMCompanion {
val Begin: AnyFSM
val End: AnyFSM
def values: Array[? <: AnyFSM]
}
enum MyFSM extends AnyFSM {
case Begin
case End
case Other
}
object MyFSM extends AnyFSMCompanion
The example above works because the cases in an enum are defined in the companion object of the enum.