Suppose I have:
trait A[AA <: A[AA]]
This does not work:
scala> object AAA extends A[AAA.type] <console>:8: error: illegal cyclic reference involving object AAA object AAA extends A[AAA.type] ^
But it works:
scala> class AAA extends A[AAA]; object AAA extends AAA defined class AAA defined module AAA
Doing almost (not quite) the same, and it works. Any reason?
PS And also, what exactly can be done inside such an object to force the infinte loop inside the compiler itself?
source share