Closed
Description
The inliner heuristic picks forwarder methods for inlining in general. However, this fails for forwarders defined in a trait that are invoked through the static super accessor:
trait T {
final def foo = bar // forwarder
@noinline def bar = 42
}
object TT extends T // gets a mixin forwarder foo, calls static T.foo$
class C {
def baz(t: T) = t.foo // inlined, so we get T.bar
def biz = TT.foo // mixin forwarder is inlined, but not the call to the static super accessor, so we get T.foo$
}
This issue was observed in scala/scala#7753.
The heuristic that selects forwarders generally excludes static super accessors, see https://github.com/scala/scala/blob/82336350de4ac3d45369c83d356b8cb0691f9d9b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala#L243-L248. However, we should inline the static super accessor if the corresponding trait method is a forwarder itself.