It looks harmless if useless to me. The type that x wants does not exist, so you cannot pass it to a method. I believe that harmless futility should be a compile-time error - that is a matter of taste.
If you look at what x actually does, it decompiles:
public java.lang.Object x(java.lang.Object); Code: 0: aload_1 1: areturn
which is what the identification method should do (load the argument regardless of type, return it). You can write something equivalent with much less code:
trait AbstractType { type T } class Useless extends AbstractType { def identity(t: AbstractType
Except that nothing is of type AbstractType # T, we again have no use.
If I'm missing something.
Rex kerr
source share