Suppose I have:
trait A[AA <: A[AA]]
//or even just `
trait A[AA]
This doesn\'t work:
scala> object AAA extends A[AAA
As you allude to in your title, the working case class AAA extends A[AAA]
is an example of F-bounded polymorphism, which is a recursive type definition where the definition refers to itself. Recursion is fairly common in types, even the humble List is recursive; it's fairly well understood territory.
However, object AAA extends A[AAA.type]
is not a recursive type. Here AAA
is a value, and your declaration asks the compiler to resolve the reference to a value's type while it is being defined, which is not a capability Scala was designed/intended to have.