Dotty Documentation

0.3.0-bin-SNAPSHOT

object tpd
extends Instance with TypedTreeInfo

Some creators for typed trees

[-] Constructors

[-] Members

[+] abstract class EnclosingMethodTraverser

A traverser that passes the enclosing class or method as an argument to the traverse method.

[+] private class FindLocalDummyAccumulator
[+] final class ListOfTreeDecorator
[+] object ListOfTreeDecorator
[+] object MaybePoly

An extractor that pulls out type arguments

[+] final class TreeOps
[+] object TreeOps
[+] class TypedTreeCopier
[+] private val InlinedCalls : Key [ List [ Tree ] ]

A key to be used in a context property that tracks enclosing inlined calls

[+] override val cpy : TypedTreeCopier
[+] val cpyBetweenPhases : TimeTravellingTreeCopier
[+] def Alternative ( trees: List [ Tree ] ) ( implicit ctx: Context ) : Alternative
[+] def AndTypeTree ( left: Tree , right: Tree ) ( implicit ctx: Context ) : AndTypeTree
[+] def Annotated ( arg: Tree , annot: Tree ) ( implicit ctx: Context ) : Annotated
[+] def AnonClass ( parents: List [ Type ] , fns: List [ TermSymbol ] , methNames: List [ TermName ] ) ( implicit ctx: Context ) : Block
[+] def AppliedTypeTree ( tycon: Tree , args: List [ Tree ] ) ( implicit ctx: Context ) : AppliedTypeTree
[+] def Apply ( fn: Tree , args: List [ Tree ] ) ( implicit ctx: Context ) : Apply
[+] def Assign ( lhs: Tree , rhs: Tree ) ( implicit ctx: Context ) : Assign
[+] def Bind ( sym: TermSymbol , body: Tree ) ( implicit ctx: Context ) : Bind
[+] def BindTyped ( sym: TermSymbol , tpe: Type ) ( implicit ctx: Context ) : Bind

A pattern corresponding to sym: tpe

[+] def Block ( stats: List [ Tree ] , expr: Tree ) ( implicit ctx: Context ) : Block
[+] def ByNameTypeTree ( result: Tree ) ( implicit ctx: Context ) : ByNameTypeTree
[+] def CaseDef ( pat: Tree , guard: Tree , body: Tree ) ( implicit ctx: Context ) : CaseDef
[+] def ClassDef ( cls: ClassSymbol , constr: DefDef , body: List [ Tree ] , superArgs: List [ Tree ] ) ( implicit ctx: Context ) : TypeDef
[+] def Closure ( env: List [ Tree ] , meth: Tree , tpt: Tree ) ( implicit ctx: Context ) : Closure
[+] def Closure ( meth: TermSymbol , rhsFn: List [ List [ Tree ] ] => Tree , targs: List [ Tree ] , targetType: Type ) ( implicit ctx: Context ) : Block

A function def

vparams => expr

gets expanded to

{ def $anonfun(vparams) = expr; Closure($anonfun) }

where the closure's type is the target type of the expression (FunctionN, unless otherwise specified).

[+] def DefDef ( sym: TermSymbol , tparams: List [ TypeSymbol ] , vparamss: List [ List [ TermSymbol ] ] , resultType: Type , rhs: Tree ) ( implicit ctx: Context ) : DefDef
[+] def DefDef ( sym: TermSymbol , rhs: Tree ) ( implicit ctx: Context ) : DefDef
[+] def DefDef ( sym: TermSymbol , rhsFn: List [ List [ Tree ] ] => Tree ) ( implicit ctx: Context ) : DefDef
[+] def Ident ( tp: NamedType ) ( implicit ctx: Context ) : Ident
[+] def If ( cond: Tree , thenp: Tree , elsep: Tree ) ( implicit ctx: Context ) : If
[+] def Import ( expr: Tree , selectors: List [ Tree ] ) ( implicit ctx: Context ) : Import
[+] def Inlined ( call: Tree , bindings: List [ MemberDef ] , expansion: Tree ) ( implicit ctx: Context ) : Inlined
[+] def JavaSeqLiteral ( elems: List [ Tree ] , elemtpt: Tree ) ( implicit ctx: Context ) : JavaSeqLiteral
[+] def LambdaTypeTree ( tparams: List [ TypeDef ] , body: Tree ) ( implicit ctx: Context ) : LambdaTypeTree
[+] def Literal ( const: Constant ) ( implicit ctx: Context ) : Literal
[+] def Match ( selector: Tree , cases: List [ CaseDef ] ) ( implicit ctx: Context ) : Match
[+] def ModuleDef ( sym: TermSymbol , body: List [ Tree ] ) ( implicit ctx: Context ) : Thicket

An object def

object obs extends parents { decls }

gets expanded to

val obj = new obj$ class obj$ extends parents { this: obj.type => decls }

(The following no longer applies: What's interesting here is that the block is well typed (because class obj$ is hoistable), but the type of the obj val is not expressible. What needs to happen in general when inferring the type of a val from its RHS, is: if the type contains a class that has the val itself as owner, then that class is remapped to have the val's owner as owner. Remapping could be done by cloning the class with the new owner and substituting everywhere in the tree. We know that remapping is safe because the only way a local class can appear in the RHS of a val is by being hoisted outside of a block, and the necessary checks are done at this point already.

On the other hand, for method result type inference, if the type of the RHS of a method contains a class owned by the method, this would be an error.)

[+] def NamedArg ( name: Name , arg: Tree ) ( implicit ctx: Context ) : NamedArg
[+] def New ( tpt: Tree ) ( implicit ctx: Context ) : New
[+] def New ( tp: Type ) ( implicit ctx: Context ) : New
[+] def New ( tp: Type , args: List [ Tree ] ) ( implicit ctx: Context ) : Apply

new C(args), calling the primary constructor of C

[+] def New ( tp: Type , constr: TermSymbol , args: List [ Tree ] ) ( implicit ctx: Context ) : Apply

new C(args), calling given constructor constr of C

[+] def OrTypeTree ( left: Tree , right: Tree ) ( implicit ctx: Context ) : OrTypeTree
[+] def PackageDef ( pid: RefTree , stats: List [ Tree ] ) ( implicit ctx: Context ) : PackageDef
[+] def RefinedTypeTree ( parent: Tree , refinements: List [ Tree ] , refineCls: ClassSymbol ) ( implicit ctx: Context ) : Tree
[+] def Return ( expr: Tree , from: Tree ) ( implicit ctx: Context ) : Return
[+] def Select ( qualifier: Tree , name: Name ) ( implicit ctx: Context ) : Select
[+] def Select ( qualifier: Tree , tp: NamedType ) ( implicit ctx: Context ) : Select
[+] def SeqLiteral ( elems: List [ Tree ] , elemtpt: Tree ) ( implicit ctx: Context ) : SeqLiteral
[+] def SingletonTypeTree ( ref: Tree ) ( implicit ctx: Context ) : SingletonTypeTree
[+] def Super ( qual: Tree , mix: Ident , inConstrCall: Boolean , mixinClass: Symbol ) ( implicit ctx: Context ) : Super
[+] def Super ( qual: Tree , mixName: TypeName , inConstrCall: Boolean , mixinClass: Symbol ) ( implicit ctx: Context ) : Super
[+] def SyntheticValDef ( name: TermName , rhs: Tree ) ( implicit ctx: Context ) : ValDef
[+] def This ( cls: ClassSymbol ) ( implicit ctx: Context ) : This
[+] def Throw ( expr: Tree ) ( implicit ctx: Context ) : Tree
[+] def Try ( block: Tree , cases: List [ CaseDef ] , finalizer: Tree ) ( implicit ctx: Context ) : Try
[+] def TypeApply ( fn: Tree , args: List [ Tree ] ) ( implicit ctx: Context ) : TypeApply
[+] def TypeBoundsTree ( lo: Tree , hi: Tree ) ( implicit ctx: Context ) : TypeBoundsTree
[+] def TypeDef ( sym: TypeSymbol ) ( implicit ctx: Context ) : TypeDef
[+] def TypeTree ( tp: Type ) ( implicit ctx: Context ) : TypeTree
[+] def Typed ( expr: Tree , tpt: Tree ) ( implicit ctx: Context ) : Typed
[+] def UnApply ( fun: Tree , implicits: List [ Tree ] , patterns: List [ Tree ] , proto: Type ) ( implicit ctx: Context ) : UnApply
[+] def Underscore ( tp: Type ) ( implicit ctx: Context ) : Ident [ Type ]

A `_' with given type

[+] def ValDef ( sym: TermSymbol , rhs: LazyTree ) ( implicit ctx: Context ) : ValDef
[+] def WhileDo ( owner: Symbol , cond: Tree , body: List [ Tree ] ) ( implicit ctx: Context ) : Tree
[+] def applyOverloaded ( receiver: Tree , method: TermName , args: List [ Tree ] , targs: List [ Type ] , expectedType: Type , isAnnotConstructor: Boolean ) ( implicit ctx: Context ) : Tree
[+] def clsOf ( tp: Type ) ( implicit ctx: Context ) : Tree

A tree that represents the class of the erasure of type tp.

[+] def defaultValue ( tpe: Type ) ( implicit ctx: Context ) : Tree
[+] def enclosingInlineds ( implicit ctx: Context ) : List [ Tree ]

All enclosing calls that are currently inlined, from innermost to outermost

[+] def evalOnce ( tree: Tree ) ( within: Tree => Tree ) ( implicit ctx: Context ) : R
[+] private def followOuterLinks ( t: Tree ) ( implicit ctx: Context ) : Tree
[+] override def inlineContext ( call: Tree ) ( implicit ctx: Context ) : Context

For untyped trees, this is just the identity. For typed trees, a context derived form ctx that records call as the innermost enclosing call for which the inlined version is currently processed.

[+] def needsSelect ( tp: Type ) ( implicit ctx: Context ) : Boolean
[+] def newArray ( elemTpe: Type , returnTpe: Type , pos: Position , dims: JavaSeqLiteral ) ( implicit ctx: Context ) : Tree

A tree representing a newXYZArray operation of the right kind for the given element type in typeArg. No type arguments or length arguments are given.

[+] def polyDefDef ( sym: TermSymbol , rhsFn: List [ Type ] => List [ List [ Tree ] ] => Tree ) ( implicit ctx: Context ) : DefDef
[+] def prefixIsElidable ( tp: NamedType ) ( implicit ctx: Context ) : Boolean
[+] def primitiveConversion ( tree: Tree , numericCls: Symbol ) ( implicit ctx: Context ) : Tree
[+] def ref ( tp: NamedType ) ( implicit ctx: Context ) : Tree

A tree representing the same reference as the given type

[+] def ref ( sym: Symbol ) ( implicit ctx: Context ) : Tree
[+] def runtimeCall ( name: TermName , args: List [ Tree ] ) ( implicit ctx: Context ) : Tree
[+] @tailrec def sameTypes ( trees: List [ Tree ] , trees1: List [ Tree ] ) : Boolean
[+] def seq ( stats: List [ Tree ] , expr: Tree ) ( implicit ctx: Context ) : Tree

Join stats in front of expr creating a new block if necessary

[+] def singleton ( tp: Type ) ( implicit ctx: Context ) : Tree
[+] override def skipTransform ( tree: Tree ) ( implicit ctx: Context ) : Boolean

Hook to indicate that a transform of some subtree should be skipped

[+] def sourceFile ( call: Tree ) ( implicit ctx: Context ) : SourceFile

The source file where the symbol of the @inline method referred to by call is defined

[+] private def ta ( implicit ctx: Context ) : TypeAssigner
[+] def unitLiteral ( implicit ctx: Context ) : Literal