"def someFun[_] (a:Int) = a", No warnings and no errors. normal?
scala, type-inference, types
Solution
The compiler generates this:
def someFun(a: Int): Int = a;
But this is not because the compiler knows that this is unused, but because of the type erasure. You can check things like this with the `-print` option of the compiler. It is also not surprising, that this works, because it is just an unused type parameter.
Problem
Out of curiosity I tried to run the following: ``` def someFun[_](a:Int) = a ``` To my surprise, no errors or warnings got issued and it runs the way you expect it to (which is fine I suppose) but is it normal that the compiler does not understand the redundancy of the type parameter or perhaps it means something that makes it (semantically?) different from this: ``` def someFun(a:Int) = a ```