Dotty Documentation

0.3.0-bin-SNAPSHOT

class ShortcutImplicits
extends DotClass with MiniPhase with IdentityDenotTransformer

This phase optimizes code using implicit function types, by applying two rewrite rules. Let IF be the implicit function type

implicit Us => R

(1) A method definition

def m(xs: Ts): IF = implicit (ys: Us) => E

is expanded to two methods:

def m(xs: Ts): IF = implicit (ys: Us) => m$direct(xs)(ys)
def m$direct(xs: Ts)(ys: Us): R = E

(and equivalently for methods with type parameters or a different number of value parameter lists). An abstract method definition

def m(xs: Ts): IF

is expanded to:

def m(xs: Ts): IF def m$direct(xs: Ts)(ys: Us): R

(2) A reference qual.apply where qual has implicit function type and qual refers to a method m is rewritten to a reference to m$direct, keeping the same type and value arguments as they are found in qual.

[-] Constructors

ShortcutImplicits ( )

[-] Members

[+] class Transform
[+] final val specializeMonoTargets : true

If this option is true, we don't specialize symbols that are known to be only targets of monomorphic calls. The reason for this option is that benchmarks show that on the JVM for monomorphic dispatch scenarios inlining and escape analysis can often remove all calling overhead, so we might as well not duplicate the code. We need more experience to decide on the best setting of this option.

[+] val treeTransform : TreeTransform
[+] override def changesMembers : Boolean

Can this transform create or delete non-private 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:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala