scala-dev
scala-dev copied to clipboard
Eliminate unused (inlined) private methods (including $anonfun)
trafficstars
Example:
class C {
def t = {
val f = (b: Int, i: Object) => 0
f(1, null)
}
}
The classfile has an unused method C$$$anonfun$1$adapted. After closure rewriting and inlining C$$$anonfun$1$adapted, method t directly invokes C$$$anonfun$1. In case that method also gets inlined, it could be eliminated as well.
Maybe requires collecting additional information from method symbols into the backend metadata: whether the method is private (in Scala's view).