You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realized that dotty still emits unnecesary forwarders:
trait T1 { def f = 1 }
trait T2 extends T1 { override def f = 2 }
trait T3 { self: T1 => override def f = 2 }
class C1 extends T1 with T2 // no forwarder needed
class C2 extends T1 with T3 // forwarder needed
Otherwise, if any superinterface of C declares a method with the name and descriptor specified by the method reference that has neither its ACC_PRIVATE flag nor its ACC_STATIC flag set, one of these is arbitrarily chosen and method lookup succeeds.
Afaik, the spec says that you need it here. Am I missing something?
If the maximally-specific superinterface methods of C for the name and descriptor specified by the method reference include exactly one method that does not have its ACC_ABSTRACT flag set, then this method is chosen and method lookup succeeds.
I believe this is now moot since scalac ended up having -Xmixin-force-forwarders default to true for performance reasons (and dotty should imitate this behavior and emit more forwarders, not less), feel free to reopen if I'm missing something.
While working on scala/scala-dev#98 to eliminate unnecessary forwarders for inherited trait methods I basically followed dotty's approach (https://github.com/lampepfl/dotty/blob/master/src/dotty/tools/dotc/transform/MixinOps.scala#L45).
I realized that dotty still emits unnecesary forwarders:
Dotty emits an unnecessary forwarder in
C1
.See scala/scala#5085 for my patch to scala/scala.
The text was updated successfully, but these errors were encountered: