In runtime I can:
def X(R: Any): Any = X(R)
But can't do simmilar thing for compile-time:
scala> type X[R] = X[R]
<console>:11: error: illegal cyclic reference involving type X
type X[R] = X[R]
^
Seems like infinite loop/recursion protection, but as far as I understand the Halting problem - there is no general way to detect infinite recursion for turing-complete language (as detector itself may not halt), so additional compiler's check will not generally work here.
So is there a way to get infinite recursion on scalac? And, is there any other (than preventing such recursion) reason to have illegal cyclic reference
?