Skip to content

Dotty emits unnecessary forwarders for trait methods #1206

Closed
@lrytz

Description

@lrytz

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:

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

Dotty emits an unnecessary forwarder in C1.

See scala/scala#5085 for my patch to scala/scala.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions