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
Members
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
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.
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.
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.
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.
List of names of phases that should precede this phase
List of names of phases that should precede this phase