class VCInlineMethods
extends MiniPhaseTransform with IdentityDenotTransformer

This phase inlines calls to methods of value classes.

A value class V after [[ExtensionMethods]] will look like: class V[A, B, ...](val underlying: U) extends AnyVal { def foo[T, S, ...](arg1: A1, arg2: A2, ...) = V.foo$extensionT, S, ..., A, B, ...(arg1, arg2, ...)

 ...

}

Let e have type V, if e is a stable prefix or if V does not have any class type parameter, then we can rewrite: e.fooX, Y, ... as: V.foo$extensionX, Y, ..., e.A, e.B, ...(args) Otherwise, we need to evaluate e first: { val ev = e V.foo$extensionX, Y, ..., ev.A, ev.B, ...(args) }

This phase needs to be placed after phases which may introduce calls to value class methods (like [[PatternMatcher]]). This phase uses name mangling to find the correct extension method corresponding to a value class method (see [[ExtensionMethods.extensionMethod]]), therefore we choose to place it before phases which may perform their own name mangling on value class methods (like [[TypeSpecializer]]), this way [[VCInlineMethods]] does not need to have any knowledge of the name mangling done by other phases.

Constructors

VCInlineMethods ( )

Members

[+] override def phaseName : String

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
private def rewire ( tree: Tree , mtArgs: List [ Tree ] , mArgss: List [ List [ Tree ] ] ) ( implicit ctx: Context ) : Tree

Replace a value class method call by a call to the corresponding extension method.

Replace a value class method call by a call to the corresponding extension method.

def rewire$default$2 : Nil$

Replace a value class method call by a call to the corresponding extension method.

Replace a value class method call by a call to the corresponding extension method.

def rewire$default$3 : Nil$

Replace a value class method call by a call to the corresponding extension method.

Replace a value class method call by a call to the corresponding extension method.

[+] private def rewireIfNeeded ( tree: Tree ) ( implicit ctx: Context ) : Tree

If this tree corresponds to a fully-applied value class method call, replace it by a call to the corresponding extension method, otherwise return it as...

If this tree corresponds to a fully-applied value class method call, replace it by a call to the corresponding extension method, otherwise return it as is.

override def runsAfter : Set [ Class [ Nothing <: Phase ] ]

List of names of phases that should precede this phase

List of names of phases that should precede this phase

override def transformApply ( tree: Apply ) ( implicit ctx: Context , info: TransformerInfo ) : Tree
override def transformSelect ( tree: Select ) ( implicit ctx: Context , info: TransformerInfo ) : Tree
override def transformTypeApply ( tree: TypeApply ) ( implicit ctx: Context , info: TransformerInfo ) : Tree