Dotty Documentation

0.6.0-bin-SNAPSHOT

class ElimByName
extends TransformByNameApply with InfoTransformer

This phase eliminates ExprTypes => T as types of method parameter references, and replaces them b nullary function types. More precisely:

For the types of parameter symbols:

   => T       ==>    () => T

For cbn parameter values

   x          ==>    x()

Note: This scheme to have inconsistent types between method types (whose formal types are still ExprTypes and parameter valdefs (which are now FunctionTypes) is not pretty. There are two other options which have been abandoned or not yet pursued.

Option 1: Transform => T to () => T also in method and function types. The problem with this is that is that it requires to look at every type, and this forces too much, causing Cyclic Reference errors. Abandoned for this reason.

Option 2: Merge ElimByName with erasure, or have it run immediately before. This has not been tried yet.

[-] Constructors

ElimByName ( )

[-] Members

[+] private def applyIfFunction ( tree: Tree , ftree: Tree ) ( implicit ctx: Context ) : Tree

Map tree to tree.apply() is ftree was of ExprType and becomes now a function

[+] override def mayChange ( sym: Symbol ) ( implicit ctx: Context ) : Boolean

Denotations with a symbol where mayChange is false are guaranteed to be unaffected by this transform, so transformInfo need not be run. This can save time, and more importantly, can help avoid forcing symbol completers.

[+] 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
[+] override def runsAfterGroupsOf : Set [ Class [ Nothing <: Phase ] ]

List of names of phases that should have finished their processing of all compilation units before this phase starts

[+] override def transformIdent ( tree: Ident ) ( implicit ctx: Context ) : Tree
[+] def transformInfo ( tp: Type , sym: Symbol ) ( implicit ctx: Context ) : Type
[+] override def transformSelect ( tree: Select ) ( implicit ctx: Context ) : Tree
[+] override def transformTypeApply ( tree: TypeApply ) ( implicit ctx: Context ) : Tree
[+] override def transformValDef ( tree: ValDef ) ( implicit ctx: Context ) : Tree