I have a
trait A extends Ordered[A] and subclasses
C which extend
compare(other: A) is defined in
C and works.
I have a list of Bs which I would like to call .sorted on but get the ‘diverging implicits’ error.
I currently get around it by doing:
listBs.map(_.asInstanceOf[A]).sorted.map(_.asInstanceOf[B]) but this is not neat.
A potential solution looks to me similar to
implicit def OrderingZ[T <: Z]: Ordering[T] = ???
but I’m not sure how to implement it.
My version would probably be?
implicit def OrderingB[B <: A]: Ordering[B] = ???.
Where should this implicit live? In class B or in a package object?
Will the underlying scala bug ever be fixed given compatibility constraints?