scala-dev icon indicating copy to clipboard operation
scala-dev copied to clipboard

Remove JFunctionN$sp.. classes

Open lrytz opened this issue 8 years ago • 0 comments

A follow-up for https://github.com/scala/scala/pull/5298 / https://github.com/scala/scala-dev/issues/121

Maybe one day we can remove the hand-specialized JFunctionN$sp.. classes by adjusting specialization to leave the specialized method abstract, instead of the generic one.

trait A[@specialized(Int) T]  {
  def apply(x: T): Int
}

currently produces

trait A {
  def apply(x: Object): Object
  def apply$mcI$sp(x: Int): String = apply(box(x))
}

If we let LMF synthesize an implementation of A, it will implement the generic method, so every invocation of the lambda will box the argument.

lrytz avatar Sep 07 '16 19:09 lrytz