Here is what I have:
sealed abstract class Codes(list: List[String])
object UVWCodes extends Codes(List("U", "V", "W"))
object XYZCodes extends Codes(List("X", "Y", "Z"))
I would like to use macros to expand the listed values into:
parse(str: String): Codes = str match {
case "U" | "V" | "W" => UVWCodes
case "X" | "Y" | "Z" => XYZCodes
}
Since Codes is a sealed class, it's possible to get the list of its subclasses. However, how to extract the list of code literals ("U", "V", etc)?