Can someone please explain why this code:
class Whole[T <: Comparable[T]](val name: T):
val parts: mutable.Map[T, Part[T]] = mutable.LinkedHashMap()
class Part[T <: Comparable[T]](val whole: Whole[T], val name: T):
//...
def this(whole: Whole[T], part: Part[T]) =
this(whole, part.name)
//...
is giving the compiler error below on the line invoking the primary constructor this(whole, part.name)?
None of the overloaded alternatives of constructor Part in class Part with types
[T <: Comparable[T]]
(whole: Whole[T], part: Part[T]): Part[T]
[T <: Comparable[T]]
(whole: Whole[T], name: T): Part[T]
match arguments ((whole : Whole[T]), (part.name : T))
this(whole, part.name)
How would I make this work?
I'm using Scala 3.2.1.
Everything is fine if I remove the type bounds...