Diverging implicit expansion errors

#1

I have a trait A extends Ordered[A] and subclasses B, and C which extend A.
The compare(other: A) is defined in B and 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] = ???
from
Previous q

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?

#2

I have a list of Bs which I would like to call .sorted on but get the ‘diverging implicits’ error.

Works for me: https://scastie.scala-lang.org/TahGqOYfSTm4I13HCNEGWA