I have the following:
sealed trait Tag
case object MyTag1 extends Tag
case object MyTag2 extends Tag
sealed trait Error[T <: Tag]
// error implementations...
I'd like for two Error implementations using the same Tag to fail at compile time, but not fail in the case there are Tags without an associated Error.
The compilation guard given in the first answer here: How can I verify type existence on compile time in Scala comes very close to what I want, but fails at compile time if there exists a Tag without an associated Error.
You can try to add one more case to the
Poly