I'm not understanding what this error wants me to do:
Type mismatch, expected: T, actual: T
I only have 3 lines of code:
case class BaseElem[T](e: T)
case class OrderedElem[T <: Ordered](override val e: T) extends BaseElem[T](e) with Ordered[OrderedElem[T]] {
override def compare(that: OrderedElem[T]): Int = this.e.compare(that.e)
}
BaseElem is a simple container of T's. OrderedElem is an Ordered container of T <: Ordered. So I want a comparison between OrderedElems to be the comparison of their respective elements.
The error is in the override of compare, the code highlighted by the error is that.e.
What is this error saying and how do I fix it?
Side question, can the declaration of
OrderedElembe simplified and retain the desired semantics?