MixinOps

dotty.tools.dotc.transform.MixinOps
class MixinOps(cls: ClassSymbol, thisPhase: DenotTransformer)(using x$3: Context)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def forwarderRhsFn(target: Symbol): List[List[Tree]] => Tree

Is sym a member of implementing class cls? The test is performed at phase thisPhase.

Is sym a member of implementing class cls? The test is performed at phase thisPhase.

Attributes

def mkForwarderSym(member: TermSymbol, extraFlags: FlagSet = ...): TermSymbol

meth needs a forwarder in class cls if

meth needs a forwarder in class cls if

  • A non-trait base class defines matching method. Example: class C {def f: Int}; trait T extends C {def f = 1}; class D extends T Even if C.f is abstract, the forwarder in D is needed, otherwise the JVM would resolve D.f to C.f, see jvms-6.5.invokevirtual.

  • There exists another concrete, matching method in any of the base classes, and the mixinClass does not itself extend that base class. In this case the forwarder is needed to disambiguate. Example: trait T1 {def f = 1}; trait T2 extends T1 {override def f = 2}; class C extends T2 In C we don't need a forwarder for f because T2 extends T1, so the JVM resolves C.f to T2.f non-ambiguously. See jvms-5.4.3.3, "maximally-specific method". trait U1 {def f = 1}; trait U2 {self:U1 => override def f = 2}; class D extends U2 In D the forwarder is needed, the interfaces U1 and U2 are unrelated at the JVM level.

Attributes

def superRef(target: Symbol, span: Span = ...): Tree

Concrete fields